diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/feed.rb | 2 | ||||
-rw-r--r-- | app/models/status.rb | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/app/models/feed.rb b/app/models/feed.rb index e7f2ab3a5..6337726be 100644 --- a/app/models/feed.rb +++ b/app/models/feed.rb @@ -16,7 +16,7 @@ class Feed RegenerationWorker.perform_async(@account.id, @type) @statuses = Status.send("as_#{@type}_timeline", @account).paginate_by_max_id(limit, nil, nil) else - status_map = Status.where(id: unhydrated).with_includes.with_counters.map { |status| [status.id, status] }.to_h + status_map = Status.where(id: unhydrated).with_includes.map { |status| [status.id, status] }.to_h @statuses = unhydrated.map { |id| status_map[id] }.compact end diff --git a/app/models/status.rb b/app/models/status.rb index 53987c3ec..708fef17f 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -4,7 +4,7 @@ class Status < ApplicationRecord include Paginable include Streamable - belongs_to :account, -> { with_counters }, inverse_of: :statuses + belongs_to :account, inverse_of: :statuses belongs_to :thread, foreign_key: 'in_reply_to_id', class_name: 'Status', inverse_of: :replies belongs_to :reblog, foreign_key: 'reblog_of_id', class_name: 'Status', inverse_of: :reblogs, touch: true @@ -27,7 +27,7 @@ class Status < ApplicationRecord default_scope { order('id desc') } scope :with_counters, -> { select('statuses.*, (select count(r.id) from statuses as r where r.reblog_of_id = statuses.id) as reblogs_count, (select count(f.id) from favourites as f where f.status_id = statuses.id) as favourites_count') } - scope :with_includes, -> { includes(:account, :media_attachments, :tags, :stream_entry, mentions: :account, reblog: [:account, mentions: :account], thread: :account) } + scope :with_includes, -> { includes(:account, :media_attachments, :tags, :stream_entry, mentions: :account, reblog: [:account, :stream_entry, :tags, mentions: :account], thread: :account) } def local? uri.nil? |