diff options
author | Thibaut Girka <thib@sitedethib.com> | 2018-05-14 20:51:50 +0200 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2018-05-14 20:51:50 +0200 |
commit | ba7ee67498905cbc96d531d45a80e284880e09ee (patch) | |
tree | 755476fb27484fb36bd01578f8f22d4dd8d64562 /app/models/concerns/status_threading_concern.rb | |
parent | 46659655439e7d76726aa38ed5d599a795b3790f (diff) | |
parent | 03b69ebc450efc07246bd64204276941b7ede3fc (diff) |
Merge branch 'master' into glitch-soc/merge
Diffstat (limited to 'app/models/concerns/status_threading_concern.rb')
-rw-r--r-- | app/models/concerns/status_threading_concern.rb | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/app/models/concerns/status_threading_concern.rb b/app/models/concerns/status_threading_concern.rb index 8e817be00..1ba8fc693 100644 --- a/app/models/concerns/status_threading_concern.rb +++ b/app/models/concerns/status_threading_concern.rb @@ -74,16 +74,7 @@ module StatusThreadingConcern statuses = statuses_with_accounts(ids).to_a account_ids = statuses.map(&:account_id).uniq domains = statuses.map(&:account_domain).compact.uniq - - relations = if account.present? - { - blocking: Account.blocking_map(account_ids, account.id), - blocked_by: Account.blocked_by_map(account_ids, account.id), - muting: Account.muting_map(account_ids, account.id), - following: Account.following_map(account_ids, account.id), - domain_blocking_by_domain: Account.domain_blocking_map_by_domain(domains, account.id), - } - end + relations = relations_map_for_account(account, account_ids, domains) statuses.reject! { |status| filter_from_context?(status, account, relations) } @@ -91,6 +82,18 @@ module StatusThreadingConcern statuses.sort_by! { |status| ids.index(status.id) } end + def relations_map_for_account(account, account_ids, domains) + return {} if account.nil? + + { + blocking: Account.blocking_map(account_ids, account.id), + blocked_by: Account.blocked_by_map(account_ids, account.id), + muting: Account.muting_map(account_ids, account.id), + following: Account.following_map(account_ids, account.id), + domain_blocking_by_domain: Account.domain_blocking_map_by_domain(domains, account.id), + } + end + def statuses_with_accounts(ids) Status.where(id: ids).includes(:account) end |