fix(graphql): fix checking actor identity when publishing event announcements

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2024-01-08 17:32:56 +01:00
parent 10c4038b85
commit 5bc0593ed6
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
1 changed files with 8 additions and 3 deletions

View File

@ -381,10 +381,15 @@ defmodule Mobilizon.GraphQL.Resolvers.Participant do
visibility: :private
})
with {:member, true} <-
with {:ok,
%Event{organizer_actor_id: organizer_actor_id, attributed_to_id: attributed_to_id} =
_event} <- Mobilizon.Events.get_event(event_id),
{:member, true} <-
{:member,
to_string(current_actor_id) == to_string(actor_id) or
Actors.member?(current_actor_id, actor_id)},
(to_string(current_actor_id) == to_string(organizer_actor_id) and
to_string(current_actor_id) == to_string(actor_id)) or
(!is_nil(attributed_to_id) and Actors.member?(current_actor_id, attributed_to_id) and
to_string(attributed_to_id) == to_string(actor_id))},
{:ok, _activity, %Conversation{} = conversation} <- Comments.create_conversation(args) do
{:ok, conversation_to_view(conversation, Actors.get_actor(actor_id))}
else