From f1084c101fbb9d33d34614056b35e069c5e4e6ce Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Tue, 5 Dec 2023 07:59:06 +0100 Subject: [PATCH 1/5] 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 2963deacd..121d6a1bc 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} -> From 89d1ee42f4577650ebf9b996a518019b2e0f373c Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Tue, 5 Dec 2023 08:06:16 +0100 Subject: [PATCH 2/5] fix(backend): handle ecto errors when fetching and create entities Signed-off-by: Thomas Citharel --- lib/federation/activity_pub/fetcher.ex | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/federation/activity_pub/fetcher.ex b/lib/federation/activity_pub/fetcher.ex index 97166baa2..288c4a394 100644 --- a/lib/federation/activity_pub/fetcher.ex +++ b/lib/federation/activity_pub/fetcher.ex @@ -42,7 +42,7 @@ defmodule Mobilizon.Federation.ActivityPub.Fetcher do end @spec fetch_and_create(String.t(), Keyword.t()) :: - {:ok, map(), struct()} | {:error, atom()} | :error + {:ok, map(), struct()} | {:error, atom()} | {:error, Ecto.Changeset.t()} | :error def fetch_and_create(url, options \\ []) do case fetch(url, options) do {:ok, data} when is_map(data) -> @@ -61,6 +61,9 @@ defmodule Mobilizon.Federation.ActivityPub.Fetcher do {:error, error} when is_atom(error) -> {:error, error} + {:error, %Ecto.Changeset{} = err} -> + {:error, err} + :error -> {:error, :transmogrifier_error} end From c4d2ec69ad4ba6fc1f631adaca26b58e9e6f24e8 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Tue, 5 Dec 2023 08:14:43 +0100 Subject: [PATCH 3/5] fix(front): only show participants & announcements menu items to organizers Signed-off-by: Thomas Citharel --- src/components/Event/EventActionSection.vue | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/components/Event/EventActionSection.vue b/src/components/Event/EventActionSection.vue index f094f8b4a..46bfb8a87 100644 --- a/src/components/Event/EventActionSection.vue +++ b/src/components/Event/EventActionSection.vue @@ -107,11 +107,7 @@ {{ t("Actions") }} - + - + - +