diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/account.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/account.rb b/app/models/account.rb index bfb10ae51..25316c9a4 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -127,6 +127,14 @@ class Account < ApplicationRecord nil end + def self.following_map(target_account_ids, account_id) + Follow.where(target_account_id: target_account_ids).where(account_id: account_id).map { |f| [f.target_account_id, true] }.to_h + end + + def self.followed_by_map(target_account_ids, account_id) + Follow.where(account_id: target_account_ids).where(target_account_id: account_id).map { |f| [f.account_id, true] }.to_h + end + before_create do if local? keypair = OpenSSL::PKey::RSA.new(Rails.env.test? ? 1024 : 2048) |