about summary refs log tree commit diff
path: root/app/lib
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-09-26 23:55:21 -0500
committerFire Demon <firedemon@creature.cafe>2020-09-27 00:03:08 -0500
commit63046c8cb9df8e797d53566f2050313d757b089b (patch)
treee3e0f3f33ad5c37b440a72125bfb12d792cc0f31 /app/lib
parent545dae4a23f7ca4833425ca31257b74a823f63a3 (diff)
Limit visibility of replies to silenced and suspended accounts to "unlisted" and "limited", respectively
Diffstat (limited to 'app/lib')
-rw-r--r--app/lib/activitypub/activity/create.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb
index c74ca1d58..f6d81af99 100644
--- a/app/lib/activitypub/activity/create.rb
+++ b/app/lib/activitypub/activity/create.rb
@@ -193,6 +193,8 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
   end
 
   def process_audience
+    @params[:visibility] = :unlisted if @account.silenced? && @params[:visibility] == :public
+
     (audience_to + audience_cc).uniq.each do |audience|
       next if audience == ActivityPub::TagManager::COLLECTIONS[:public]
 
@@ -204,11 +206,12 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
       next if account.nil? || @mentions.any? { |mention| mention.account_id == account.id }
 
       @mentions << Mention.new(account: account, silent: true)
+      @params[:visibility] = :unlisted if account.silenced? && @params[:visibility] == :public
 
       # If there is at least one silent mention, then the status can be considered
       # as a limited-audience status, and not strictly a direct message, but only
       # if we considered a direct message in the first place
-      next unless @params[:visibility] == :direct && direct_message.nil?
+      next unless account.suspended? || (@params[:visibility] == :direct && direct_message.nil?)
 
       @params[:visibility] = :limited
     end