about summary refs log tree commit diff
path: root/app/lib/activitypub
diff options
context:
space:
mode:
Diffstat (limited to 'app/lib/activitypub')
-rw-r--r--app/lib/activitypub/activity/create.rb4
-rw-r--r--app/lib/activitypub/parser/status_parser.rb6
2 files changed, 8 insertions, 2 deletions
diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb
index ea8d146d4..cf31b6ff6 100644
--- a/app/lib/activitypub/activity/create.rb
+++ b/app/lib/activitypub/activity/create.rb
@@ -152,7 +152,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
       # 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
-      @params[:visibility] = :limited if @params[:visibility] == :direct
+      @params[:visibility] = :limited if @params[:visibility] == :direct && !@object['directMessage']
     end
 
     # Accounts that are tagged but are not in the audience are not
@@ -164,7 +164,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
     return if @status.mentions.find_by(account_id: @options[:delivered_to_account_id])
 
     @status.mentions.create(account: delivered_to_account, silent: true)
-    @status.update(visibility: :limited) if @status.direct_visibility?
+    @status.update(visibility: :limited) if @status.direct_visibility? && !@object['directMessage']
 
     return unless delivered_to_account.following?(@account)
 
diff --git a/app/lib/activitypub/parser/status_parser.rb b/app/lib/activitypub/parser/status_parser.rb
index 3ba154d01..75b8f3d5c 100644
--- a/app/lib/activitypub/parser/status_parser.rb
+++ b/app/lib/activitypub/parser/status_parser.rb
@@ -79,6 +79,8 @@ class ActivityPub::Parser::StatusParser
       :unlisted
     elsif audience_to.include?(@magic_values[:followers_collection])
       :private
+    elsif direct_message == false
+      :limited
     else
       :direct
     end
@@ -94,6 +96,10 @@ class ActivityPub::Parser::StatusParser
     end
   end
 
+  def direct_message
+    @object['directMessage']
+  end
+
   private
 
   def audience_to