diff --git a/lib/graphql/resolvers/participant.ex b/lib/graphql/resolvers/participant.ex index e752c0a51..f488e88c8 100644 --- a/lib/graphql/resolvers/participant.ex +++ b/lib/graphql/resolvers/participant.ex @@ -282,6 +282,9 @@ defmodule Mobilizon.GraphQL.Resolvers.Participant do {:error, dgettext("errors", "Participation is confirmed but not approved yet by an organizer")} + {:has_participant, %Participant{role: :participant}} -> + {:error, dgettext("errors", "Participation is already confirmed")} + {:has_participant, nil} -> {:error, dgettext("errors", "This token is invalid")} diff --git a/test/graphql/resolvers/participant_test.exs b/test/graphql/resolvers/participant_test.exs index bd431f14b..8c8201d8b 100644 --- a/test/graphql/resolvers/participant_test.exs +++ b/test/graphql/resolvers/participant_test.exs @@ -1136,6 +1136,15 @@ defmodule Mobilizon.GraphQL.Resolvers.ParticipantTest do assert %Participant{role: :participant} = event.id |> Events.list_participants_for_event() |> Map.get(:elements) |> hd() + res = + conn + |> AbsintheHelpers.graphql_query( + query: @confirmation_mutation, + variables: %{confirmationToken: confirmation_token} + ) + + assert hd(res["errors"])["message"] == "Participation is already confirmed" + assert_email_sent(to: @email) end