forked from potsda.mn/mobilizon
fix(participant): handle re-confirming participation
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
02098bbb3d
commit
5cc5c9943c
|
@ -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")}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue