fix(activitypub): consider PM as private conversations even if attributed_to_id is defined

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2024-01-05 16:32:03 +01:00
parent 456dc36f64
commit 387d3b1c30
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773

View file

@ -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) ->