diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-03-15 22:52:57 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-03-15 22:55:45 +0100 |
commit | 74ae158c2f7b7d282ce1cc754ac83d27467a7215 (patch) | |
tree | 59f599673fd1121f596684961ea47f8236c1b5f8 /app/services | |
parent | c1124228e857b0e85f5bf927d2c41c7fadfdf955 (diff) |
Add "direct" visibility level in the backend. Web UI is not yet
adjusted to allow choosing it, yet
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/fan_out_on_write_service.rb | 13 | ||||
-rw-r--r-- | app/services/reblog_service.rb | 2 |
2 files changed, 13 insertions, 2 deletions
diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb index 71f6cbca1..0cacfd7cd 100644 --- a/app/services/fan_out_on_write_service.rb +++ b/app/services/fan_out_on_write_service.rb @@ -5,7 +5,8 @@ class FanOutOnWriteService < BaseService # @param [Status] status def call(status) deliver_to_self(status) if status.account.local? - deliver_to_followers(status) + + status.direct_visibility? ? deliver_to_mentioned_followers(status) : deliver_to_followers(status) return if status.account.silenced? || !status.public_visibility? || status.reblog? @@ -32,6 +33,16 @@ class FanOutOnWriteService < BaseService end end + def deliver_to_mentioned_followers(status) + Rails.logger.debug "Delivering status #{status.id} to mentioned followers" + + status.mentions.includes(:account).each do |mention| + mentioned_account = mention.account + next if !mentioned_account.local? || !mentioned_account.following?(status.account) || FeedManager.instance.filter?(:home, status, mentioned_account) + FeedManager.instance.push(:home, mentioned_account, status) + end + end + def deliver_to_hashtags(status) Rails.logger.debug "Delivering status #{status.id} to hashtags" diff --git a/app/services/reblog_service.rb b/app/services/reblog_service.rb index c14b2925a..11446ce28 100644 --- a/app/services/reblog_service.rb +++ b/app/services/reblog_service.rb @@ -10,7 +10,7 @@ class ReblogService < BaseService def call(account, reblogged_status) reblogged_status = reblogged_status.reblog if reblogged_status.reblog? - raise Mastodon::NotPermittedError if reblogged_status.private_visibility? || !reblogged_status.permitted?(account) + raise Mastodon::NotPermittedError if reblogged_status.direct_visibility? || reblogged_status.private_visibility? || !reblogged_status.permitted?(account) reblog = account.statuses.create!(reblog: reblogged_status, text: '') |