From 909d0d5e88b046f8bb69c893c54944bb2aad12cf Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 27 Oct 2016 19:33:04 +0200 Subject: Adding public timeline silencing --- app/models/status.rb | 7 ++++++- app/services/fan_out_on_write_service.rb | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/models/status.rb b/app/models/status.rb index 8b7c9c823..19c0488d0 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -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) diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb index 312994db5..707f74c35 100644 --- a/app/services/fan_out_on_write_service.rb +++ b/app/services/fan_out_on_write_service.rb @@ -30,6 +30,7 @@ class FanOutOnWriteService < BaseService end def deliver_to_public(status) + return if status.account.silenced? FeedManager.instance.broadcast(:public, id: status.id) end end -- cgit