fix(back): Various small fixes in backend

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2023-05-03 10:03:21 +02:00
parent 3d21a06789
commit 2a57340a82
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773
3 changed files with 7 additions and 2 deletions

View file

@ -278,6 +278,10 @@ defmodule Mobilizon.GraphQL.Resolvers.Participant do
Participations.update(participant, actor, Events.get_default_participant_role(event)) do Participations.update(participant, actor, Events.get_default_participant_role(event)) do
{:ok, participant} {:ok, participant}
else else
{:has_participant, %Participant{role: :not_approved}} ->
{:error,
dgettext("errors", "Participation is confirmed but not approved yet by an organizer")}
{:has_participant, nil} -> {:has_participant, nil} ->
{:error, dgettext("errors", "This token is invalid")} {:error, dgettext("errors", "This token is invalid")}

View file

@ -228,7 +228,8 @@ defmodule Mobilizon.Service.ActorSuspension do
Enum.each(participations, &Events.delete_participant/1) Enum.each(participations, &Events.delete_participant/1)
end 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() @spec delete_members(Multi.t(), Actor.t()) :: Multi.t()
defp delete_members(%Multi{} = multi, %Actor{type: :Person, id: actor_id}) do defp delete_members(%Multi{} = multi, %Actor{type: :Person, id: actor_id}) do

View file

@ -17,7 +17,7 @@ defmodule Mobilizon.Service.Workers.EventDelayedNotificationWorker do
%Event{draft: false} = event -> %Event{draft: false} = event ->
Group.notify_of_new_event(event) Group.notify_of_new_event(event)
nil -> _ ->
# Event still a draft or event deleted inbetween, no worries, just ignore # Event still a draft or event deleted inbetween, no worries, just ignore
:ok :ok
end end