mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-22 10:38:07 +01:00
Extract crutches_active_mentions from FeedManager (#27785)
This commit is contained in:
parent
ac69f90098
commit
43e2f763b2
1 changed files with 9 additions and 1 deletions
|
@ -551,7 +551,7 @@ class FeedManager
|
|||
def build_crutches(receiver_id, statuses)
|
||||
crutches = {}
|
||||
|
||||
crutches[:active_mentions] = Mention.active.where(status_id: statuses.flat_map { |s| [s.id, s.reblog_of_id] }.compact).pluck(:status_id, :account_id).each_with_object({}) { |(id, account_id), mapping| (mapping[id] ||= []).push(account_id) }
|
||||
crutches[:active_mentions] = crutches_active_mentions(statuses)
|
||||
|
||||
check_for_blocks = statuses.flat_map do |s|
|
||||
arr = crutches[:active_mentions][s.id] || []
|
||||
|
@ -578,4 +578,12 @@ class FeedManager
|
|||
|
||||
crutches
|
||||
end
|
||||
|
||||
def crutches_active_mentions(statuses)
|
||||
Mention
|
||||
.active
|
||||
.where(status_id: statuses.flat_map { |status| [status.id, status.reblog_of_id] }.compact)
|
||||
.pluck(:status_id, :account_id)
|
||||
.each_with_object({}) { |(id, account_id), mapping| (mapping[id] ||= []).push(account_id) }
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue