Run mix format and fix a credo check

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2019-09-09 09:35:50 +02:00
parent 4418275223
commit cc4a59ad1f
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773
6 changed files with 10 additions and 12 deletions

View file

@ -8,7 +8,7 @@ defmodule Mobilizon.Actors.Member do
import Ecto.Changeset import Ecto.Changeset
alias Mobilizon.Actors.{Actor, Member, MemberRole} alias Mobilizon.Actors.{Actor, Member, MemberRole}
@type t :: %__MODULE__{ @type t :: %__MODULE__{
role: MemberRole.t(), role: MemberRole.t(),
parent: Actor.t(), parent: Actor.t(),

View file

@ -93,8 +93,7 @@ defmodule Mobilizon.Application do
def named_version, do: @name <> " " <> @version def named_version, do: @name <> " " <> @version
def user_agent do def user_agent do
info = info = "#{MobilizonWeb.Endpoint.url()} <#{Config.get([:instance, :email], "")}>"
"#{MobilizonWeb.Endpoint.url()} <#{Config.get([:instance, :email], "")}>"
named_version() <> "; " <> info named_version() <> "; " <> info
end end

View file

@ -112,7 +112,8 @@ defmodule MobilizonWeb.Resolvers.User do
""" """
@spec create_user(any(), map(), any()) :: tuple() @spec create_user(any(), map(), any()) :: tuple()
def create_user(_parent, args, _resolution) do def create_user(_parent, args, _resolution) do
with {:registrations_open, true} <- {:registrations_open, Config.instance_registrations_open?()}, with {:registrations_open, true} <-
{:registrations_open, Config.instance_registrations_open?()},
{:ok, %User{} = user} <- Users.register(args) do {:ok, %User{} = user} <- Users.register(args) do
Activation.send_confirmation_email(user) Activation.send_confirmation_email(user)
{:ok, user} {:ok, user}

View file

@ -113,7 +113,6 @@ defmodule Mobilizon.Service.ActivityPub do
end end
end end
@doc """ @doc """
Getting an actor from url, eventually creating it Getting an actor from url, eventually creating it
""" """

View file

@ -16,16 +16,17 @@ defmodule Mobilizon.Service.HTTPSignatures.Signature do
require Logger require Logger
def key_id_to_actor_url(key_id) do def key_id_to_actor_url(key_id) do
%{path: path} = uri = %{path: path} =
uri =
key_id key_id
|> URI.parse() |> URI.parse()
|> Map.put(:fragment, nil) |> Map.put(:fragment, nil)
uri = uri =
if not is_nil(path) do if is_nil(path) do
Map.put(uri, :path, String.trim_trailing(path, "/publickey"))
else
uri uri
else
Map.put(uri, :path, String.trim_trailing(path, "/publickey"))
end end
URI.to_string(uri) URI.to_string(uri)

View file

@ -157,9 +157,7 @@ defmodule Mobilizon.ActorsTest do
event = insert(:event, organizer_actor: actor) event = insert(:event, organizer_actor: actor)
event_found_id = event_found_id =
Actors.get_actor_by_name_with_preload( Actors.get_actor_by_name_with_preload("#{actor.preferred_username}@#{actor.domain}").organized_events
"#{actor.preferred_username}@#{actor.domain}"
).organized_events
|> hd |> hd
|> Map.get(:id) |> Map.get(:id)