fix error when loading posts

This commit is contained in:
Kay Faraday 2023-07-29 16:49:10 +00:00
parent caa7762b42
commit 36154f413b
1 changed files with 2 additions and 4 deletions

View File

@ -107,9 +107,7 @@ class Status < ApplicationRecord
scope :not_domain_blocked_by_account, ->(account) { account.excluded_from_timeline_domains.blank? ? left_outer_joins(:account) : left_outer_joins(:account).where('accounts.domain IS NULL OR accounts.domain NOT IN (?)', account.excluded_from_timeline_domains) }
scope :tagged_with_all, lambda { |tag_ids|
Array(tag_ids).map(&:to_i).reduce(self) do |result, id|
result.where(<<~SQL.squish, tag_id: id)
EXISTS(SELECT 1 FROM statuses_tags WHERE statuses_tags.status_id = statuses.id AND statuses_tags.tag_id = :tag_id)
SQL
result.joins("INNER JOIN statuses_tags t#{id} ON t#{id}.status_id = statuses.id AND t#{id}.tag_id = #{id}")
end
}
scope :tagged_with_none, lambda { |tag_ids|
@ -306,7 +304,7 @@ class Status < ApplicationRecord
end
end
ActiveRecord::Associations::Preloader.new.preload(records, :custom_emoji)
ActiveRecord::Associations::Preloader.new(records: records, associations: :custom_emoji)
records
end