From 2a57340a82e414e69924ad89e8db9fc326742cc7 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 3 May 2023 10:03:21 +0200 Subject: [PATCH] fix(back): Various small fixes in backend Signed-off-by: Thomas Citharel --- lib/graphql/resolvers/participant.ex | 4 ++++ lib/service/actor_suspension.ex | 3 ++- lib/service/workers/event_delayed_notification_worker.ex | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/graphql/resolvers/participant.ex b/lib/graphql/resolvers/participant.ex index cfd067b9..a972c0a4 100644 --- a/lib/graphql/resolvers/participant.ex +++ b/lib/graphql/resolvers/participant.ex @@ -278,6 +278,10 @@ defmodule Mobilizon.GraphQL.Resolvers.Participant do Participations.update(participant, actor, Events.get_default_participant_role(event)) do {:ok, participant} else + {:has_participant, %Participant{role: :not_approved}} -> + {:error, + dgettext("errors", "Participation is confirmed but not approved yet by an organizer")} + {:has_participant, nil} -> {:error, dgettext("errors", "This token is invalid")} diff --git a/lib/service/actor_suspension.ex b/lib/service/actor_suspension.ex index 0d34bb6c..b5531a9d 100644 --- a/lib/service/actor_suspension.ex +++ b/lib/service/actor_suspension.ex @@ -228,7 +228,8 @@ defmodule Mobilizon.Service.ActorSuspension do Enum.each(participations, &Events.delete_participant/1) end - defp delete_participations(%Actor{type: :Group}), do: :ok + # Ignore for all other types of actors + defp delete_participations(%Actor{}), do: :ok @spec delete_members(Multi.t(), Actor.t()) :: Multi.t() defp delete_members(%Multi{} = multi, %Actor{type: :Person, id: actor_id}) do diff --git a/lib/service/workers/event_delayed_notification_worker.ex b/lib/service/workers/event_delayed_notification_worker.ex index 5eaa0709..60102c7b 100644 --- a/lib/service/workers/event_delayed_notification_worker.ex +++ b/lib/service/workers/event_delayed_notification_worker.ex @@ -17,7 +17,7 @@ defmodule Mobilizon.Service.Workers.EventDelayedNotificationWorker do %Event{draft: false} = event -> Group.notify_of_new_event(event) - nil -> + _ -> # Event still a draft or event deleted inbetween, no worries, just ignore :ok end