about summary refs log tree commit diff
path: root/app/models/concerns/account_interactions.rb
diff options
context:
space:
mode:
authorTakeshi Umeda <noel.yoshiba@gmail.com>2023-03-21 18:32:58 +0900
committerGitHub <noreply@github.com>2023-03-21 10:32:58 +0100
commit38c84f57b6d2de1683974f91d726c30ba7f1491b (patch)
tree35b416ccf1ddbd37aaf07bce0f52e590fb896dd8 /app/models/concerns/account_interactions.rb
parent9f8d1601a4877459b4d332d03796e5b70f07134e (diff)
Refactoring relations_map (#24195)
Diffstat (limited to 'app/models/concerns/account_interactions.rb')
-rw-r--r--app/models/concerns/account_interactions.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/models/concerns/account_interactions.rb b/app/models/concerns/account_interactions.rb
index 1898516b0..48ab1349d 100644
--- a/app/models/concerns/account_interactions.rb
+++ b/app/models/concerns/account_interactions.rb
@@ -292,6 +292,21 @@ module AccountInteractions
     end
   end
 
+  def relations_map(account_ids, domains = nil, **options)
+    relations = {
+      blocked_by: Account.blocked_by_map(account_ids, id),
+      following: Account.following_map(account_ids, id),
+    }
+
+    return relations if options[:skip_blocking_and_muting]
+
+    relations.merge!({
+      blocking: Account.blocking_map(account_ids, id),
+      muting: Account.muting_map(account_ids, id),
+      domain_blocking_by_domain: Account.domain_blocking_map_by_domain(domains, id),
+    })
+  end
+
   private
 
   def remove_potential_friendship(other_account)