Allow to create an event from a group preconfigured with the organizer

Refactored the organizer-picker components a lot

Close #464

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-03-29 10:33:19 +02:00
parent cde9f8873e
commit 13c8080097
8 changed files with 194 additions and 188 deletions

View File

@@ -315,7 +315,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Person do
context: %{current_user: user}
}) do
with {:is_owned, %Actor{id: actor_id}} <- User.owns_actor(user, actor_id),
%Actor{id: group_id} <- Actors.get_actor_by_name(group, :Group),
{:group, %Actor{id: group_id}} <- {:group, Actors.get_actor_by_name(group, :Group)},
{:ok, %Member{} = membership} <- Actors.get_member(actor_id, group_id),
memberships <- %Page{
total: 1,
@@ -326,6 +326,9 @@ defmodule Mobilizon.GraphQL.Resolvers.Person do
{:error, :member_not_found} ->
{:ok, %Page{total: 0, elements: []}}
{:group, nil} ->
{:error, :group_not_found}
{:is_owned, nil} ->
{:error, dgettext("errors", "Profile is not owned by authenticated user")}
end