0
0
Fork 0

Fix notifications in UI, added new API for fetching account relationships

This commit is contained in:
Eugen Rochko 2016-09-21 22:07:18 +02:00
parent 4bec613897
commit e46abc71ca
11 changed files with 91 additions and 17 deletions

View file

@ -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)