Various refactoring and typespec improvements

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-09-24 16:46:42 +02:00
parent d235653876
commit 1893d9f55b
142 changed files with 1854 additions and 1297 deletions

View File

@@ -94,7 +94,7 @@ defmodule Mix.Tasks.Mobilizon.Actors.New do
{:admin, nil} ->
shell_error("Profile with username #{Keyword.get(options, :group_admin)} wasn't found")
{:error, :insert_group, %Ecto.Changeset{errors: errors}, _} ->
{:error, %Ecto.Changeset{errors: errors}} ->
shell_error(inspect(errors))
shell_error("Error while creating group because of the above reason")
end

View File

@@ -50,6 +50,8 @@ defmodule Mix.Tasks.Mobilizon.Actors.Utils do
new_person
end
@spec create_group(Actor.t(), String.t(), String.t(), Keyword.t()) ::
{:ok, Actor.t()} | {:error, Ecto.Changeset.t()}
def create_group(%Actor{id: admin_id}, username, name, _options \\ []) do
{username, name} = username_and_name(username, name)