0
0
Fork 0

Improving production logs, removing n+1 on media attachments in atom,

adding attachments display to static views
This commit is contained in:
Eugen Rochko 2016-09-08 01:24:26 +02:00
parent 87576e1ab1
commit 0f4bc56719
7 changed files with 45 additions and 3 deletions

View file

@ -11,7 +11,7 @@ class AccountsController < ApplicationController
format.atom do
@entries = @account.stream_entries.order('id desc').with_includes.paginate_by_max_id(20, params[:max_id] || nil)
ActiveRecord::Associations::Preloader.new.preload(@entries.select { |a| a.activity_type == 'Status' }, activity: [:mentions, reblog: :account, thread: :account])
ActiveRecord::Associations::Preloader.new.preload(@entries.select { |a| a.activity_type == 'Status' }, activity: [:mentions, :media_attachments, reblog: :account, thread: :account])
ActiveRecord::Associations::Preloader.new.preload(@entries.select { |a| a.activity_type == 'Favourite' }, activity: [:account, :status])
ActiveRecord::Associations::Preloader.new.preload(@entries.select { |a| a.activity_type == 'Follow' }, activity: :target_account)
end