From 387d3b1c30ec719a992c565fd495ef2b6642641e Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 5 Jan 2024 16:32:03 +0100 Subject: [PATCH] fix(activitypub): consider PM as private conversations even if attributed_to_id is defined Signed-off-by: Thomas Citharel --- lib/federation/activity_pub/transmogrifier.ex | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/federation/activity_pub/transmogrifier.ex b/lib/federation/activity_pub/transmogrifier.ex index 5ad5aa634..108c257e2 100644 --- a/lib/federation/activity_pub/transmogrifier.ex +++ b/lib/federation/activity_pub/transmogrifier.ex @@ -71,8 +71,10 @@ defmodule Mobilizon.Federation.ActivityPub.Transmogrifier do case Discussions.get_comment_from_url_with_preload(object["id"]) do {:error, :comment_not_found} -> case Converter.Comment.as_to_model_data(object) do - %{visibility: visibility, attributed_to_id: attributed_to_id} = object_data - when visibility === :private and is_nil(attributed_to_id) -> + %{visibility: visibility, attributed_to_id: attributed_to_id, actor_id: actor_id} = + object_data + when visibility === :private and + (is_nil(attributed_to_id) or actor_id == attributed_to_id) -> Actions.Create.create(:conversation, object_data, false) object_data when is_map(object_data) ->