fix(participant): handle re-confirming participation

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2023-06-20 15:13:05 +02:00
parent 02098bbb3d
commit 5cc5c9943c
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773
2 changed files with 12 additions and 0 deletions

View file

@ -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")}

View file

@ -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