Mix format
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
7911d08691
commit
32a06cae87
@ -174,10 +174,12 @@ defmodule Mobilizon.Actors.Actor do
|
||||
|> put_change(:local, true)
|
||||
end
|
||||
|
||||
@spec build_urls(Ecto.Changeset.t, atom()) :: Ecto.Changeset.t
|
||||
@spec build_urls(Ecto.Changeset.t(), atom()) :: Ecto.Changeset.t()
|
||||
defp build_urls(changeset, type \\ :Person)
|
||||
|
||||
defp build_urls(%Ecto.Changeset{changes: %{preferred_username: username}} = changeset, type) do
|
||||
symbol = if type == :Group, do: "~", else: "@"
|
||||
|
||||
changeset
|
||||
|> put_change(
|
||||
:outbox_url,
|
||||
|
@ -21,7 +21,7 @@ defmodule MobilizonWeb.Resolvers.Group do
|
||||
Lists all groups
|
||||
"""
|
||||
def list_groups(_parent, _args, _resolution) do
|
||||
{:ok, Actors.list_groups}
|
||||
{:ok, Actors.list_groups()}
|
||||
end
|
||||
|
||||
@doc """
|
||||
@ -34,7 +34,6 @@ defmodule MobilizonWeb.Resolvers.Group do
|
||||
context: %{current_user: user}
|
||||
}
|
||||
) do
|
||||
|
||||
with %Actor{id: actor_id} <- Actors.get_local_actor_by_name(actor_username),
|
||||
{:user_actor, true} <-
|
||||
{:user_actor, actor_id in Enum.map(Actors.get_actors_for_user(user), & &1.id)},
|
||||
@ -43,6 +42,7 @@ defmodule MobilizonWeb.Resolvers.Group do
|
||||
else
|
||||
{:error, %Ecto.Changeset{errors: [url: {"has already been taken", []}]}} ->
|
||||
{:error, :group_name_not_available}
|
||||
|
||||
err ->
|
||||
Logger.error(inspect(err))
|
||||
err
|
||||
|
@ -548,6 +548,7 @@ defmodule MobilizonWeb.Schema do
|
||||
arg(:creator_username, :string,
|
||||
description: "The actor's username which will be the admin (otherwise user's default one)"
|
||||
)
|
||||
|
||||
resolve(&Resolvers.Group.create_group/3)
|
||||
end
|
||||
|
||||
|
@ -37,6 +37,7 @@ defmodule MobilizonWeb.Resolvers.GroupResolverTest do
|
||||
|
||||
assert json_response(res, 200)["data"]["createGroup"]["preferred_username"] ==
|
||||
@new_group_params.groupname
|
||||
|
||||
assert json_response(res, 200)["data"]["createGroup"]["type"] == "GROUP"
|
||||
|
||||
mutation = """
|
||||
@ -61,6 +62,7 @@ defmodule MobilizonWeb.Resolvers.GroupResolverTest do
|
||||
|
||||
test "list_groups/3 returns all groups", context do
|
||||
group = insert(:group)
|
||||
|
||||
query = """
|
||||
{
|
||||
groups {
|
||||
|
Loading…
Reference in New Issue
Block a user