From f1084c101fbb9d33d34614056b35e069c5e4e6ce Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Tue, 5 Dec 2023 07:59:06 +0100 Subject: [PATCH] fix(activitypub): fix receiving comments Should fix race conditions and actors deleted of received comments Signed-off-by: Thomas Citharel --- lib/federation/activity_pub/transmogrifier.ex | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/federation/activity_pub/transmogrifier.ex b/lib/federation/activity_pub/transmogrifier.ex index 2963deac..121d6a1b 100644 --- a/lib/federation/activity_pub/transmogrifier.ex +++ b/lib/federation/activity_pub/transmogrifier.ex @@ -81,7 +81,14 @@ defmodule Mobilizon.Federation.ActivityPub.Transmogrifier do object_data |> transform_object_data_for_discussion() |> save_comment_or_discussion() + + {:ok, %Comment{} = comment} -> + # Object already exists + {:ok, nil, comment} end + + {:error, err} -> + {:error, err} end {:ok, %Comment{} = comment} ->