diff options
Diffstat (limited to 'app/lib/activitypub')
-rw-r--r-- | app/lib/activitypub/activity/create.rb | 4 | ||||
-rw-r--r-- | app/lib/activitypub/adapter.rb | 1 | ||||
-rw-r--r-- | app/lib/activitypub/parser/status_parser.rb | 6 |
3 files changed, 9 insertions, 2 deletions
diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb index a861c34bc..9e93cac64 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/adapter.rb b/app/lib/activitypub/adapter.rb index 776e1d3da..d8b0c63b2 100644 --- a/app/lib/activitypub/adapter.rb +++ b/app/lib/activitypub/adapter.rb @@ -7,6 +7,7 @@ class ActivityPub::Adapter < ActiveModelSerializers::Adapter::Base }.freeze CONTEXT_EXTENSION_MAP = { + direct_message: { 'litepub': 'http://litepub.social/ns#', 'directMessage': 'litepub:directMessage' }, manually_approves_followers: { 'manuallyApprovesFollowers' => 'as:manuallyApprovesFollowers' }, sensitive: { 'sensitive' => 'as:sensitive' }, hashtag: { 'Hashtag' => 'as:Hashtag' }, 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 |