about summary refs log tree commit diff
path: root/app/models/concerns/account_interactions.rb
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2018-08-11 15:28:06 +0200
committerGitHub <noreply@github.com>2018-08-11 15:28:06 +0200
commitd787bcdeb1570e4d8d67f326dadaf321a6854e06 (patch)
treefa23a187b16bf07635312a7791013aacfc2c4474 /app/models/concerns/account_interactions.rb
parent03afc365d530e6d57754ae9dbbdbd0c56431ee02 (diff)
parent7067b64de33f9cd491e97329df266fde5fb49e42 (diff)
Merge pull request #630 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/models/concerns/account_interactions.rb')
-rw-r--r--app/models/concerns/account_interactions.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/concerns/account_interactions.rb b/app/models/concerns/account_interactions.rb
index cacee54e0..ff57a884b 100644
--- a/app/models/concerns/account_interactions.rb
+++ b/app/models/concerns/account_interactions.rb
@@ -40,6 +40,10 @@ module AccountInteractions
       end
     end
 
+    def endorsed_map(target_account_ids, account_id)
+      follow_mapping(AccountPin.where(account_id: account_id, target_account_id: target_account_ids), :target_account_id)
+    end
+
     def domain_blocking_map(target_account_ids, account_id)
       accounts_map    = Account.where(id: target_account_ids).select('id, domain').map { |a| [a.id, a.domain] }.to_h
       blocked_domains = domain_blocking_map_by_domain(accounts_map.values.compact, account_id)
@@ -194,6 +198,10 @@ module AccountInteractions
     status_pins.where(status: status).exists?
   end
 
+  def endorsed?(account)
+    account_pins.where(target_account: account).exists?
+  end
+
   def followers_for_local_distribution
     followers.local
              .joins(:user)