0
0
Fork 0

Adding public timeline silencing

This commit is contained in:
Eugen Rochko 2016-10-27 19:33:04 +02:00
parent e5565a7e4a
commit 909d0d5e88
4 changed files with 25 additions and 13 deletions

View file

@ -86,7 +86,12 @@ class Status < ApplicationRecord
end
def self.as_public_timeline(account)
joins('LEFT OUTER JOIN statuses AS reblogs ON statuses.reblog_of_id = reblogs.id').where('(reblogs.account_id IS NULL OR reblogs.account_id NOT IN (SELECT target_account_id FROM blocks WHERE account_id = ?)) AND statuses.account_id NOT IN (SELECT target_account_id FROM blocks WHERE account_id = ?)', account.id, account.id).with_includes.with_counters
joins('LEFT OUTER JOIN statuses AS reblogs ON statuses.reblog_of_id = reblogs.id')
.joins('LEFT OUTER JOIN accounts ON statuses.account_id = accounts.id')
.where('accounts.silenced = FALSE')
.where('(reblogs.account_id IS NULL OR reblogs.account_id NOT IN (SELECT target_account_id FROM blocks WHERE account_id = ?)) AND statuses.account_id NOT IN (SELECT target_account_id FROM blocks WHERE account_id = ?)', account.id, account.id)
.with_includes
.with_counters
end
def self.favourites_map(status_ids, account_id)