Changes: * Drop Users.id_to_name. * Don't cache Users.name_to_id. * Replace calls to name_to_id with find_by_name when possible. * Don't autodefine creator_name in belongs_to_creator. * Don't autodefine updater_name in belongs_to_updater. * Instead manually define creator_name / updater_name only on models that need to return these fields in the api. id_to_name was cached to reduce the impact of N+1 query patterns in certain places, especially in api responses that return creator_name / updater_name fields. But it still meant we were doing N calls to memcache. Using `includes` to prefetch users avoids this N+1 pattern. name_to_id had no need be cached, it was never used in any performance- sensitive contexts. Avoiding caching also avoids the need to keep these caches consistent.
37 lines
1.4 KiB
Plaintext
37 lines
1.4 KiB
Plaintext
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
<title><%= Danbooru.config.app_name %><% if !params[:tags].blank? %>: <%= params[:tags] %><% end %></title>
|
|
<link href="<%= posts_url(tags: params[:tags], format: :atom) %>" rel="self"/>
|
|
<link href="<%= posts_url(tags: params[:tags]) %>" rel="alternate"/>
|
|
<id><%= posts_url(tags: params[:tags], format: :atom) %></id>
|
|
<% if @posts.any? %>
|
|
<updated><%= @posts[0].created_at.gmtime.xmlschema %></updated>
|
|
<% end %>
|
|
<author><name><%= Danbooru.config.app_name %></name></author>
|
|
|
|
<% Danbooru.config.select_posts_visible_to_user(CurrentUser.user, @posts).each do |post| %>
|
|
<entry>
|
|
<title><%= post.presenter.humanized_essential_tag_string %></title>
|
|
<link href="<%= post_url(post) %>" rel="alternate"/>
|
|
<% if post.source =~ %r{\Ahttps?://} %>
|
|
<link href="<%= post.source %>" rel="related"/>
|
|
<% end %>
|
|
<id><%= post_url(post) %></id>
|
|
<updated><%= post.created_at.gmtime.xmlschema %></updated>
|
|
<summary><%= post.tag_string %></summary>
|
|
<content type="xhtml">
|
|
<div xmlns="http://www.w3.org/1999/xhtml">
|
|
<%= link_to post_url(post) do %>
|
|
<%= image_tag post.preview_file_url %>
|
|
<% end %>
|
|
<p><%= post.tag_string %></p>
|
|
</div>
|
|
</content>
|
|
<author>
|
|
<name><%= post.uploader.name %></name>
|
|
</author>
|
|
</entry>
|
|
<% end %>
|
|
</feed>
|