From ecd4675387a3e650eefce83aabb1d33d019ecfa4 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Mon, 9 Sep 2019 09:35:50 +0200 Subject: [PATCH] Run mix format and fix a credo check Signed-off-by: Thomas Citharel --- lib/mobilizon/actors/member.ex | 2 +- lib/mobilizon/application.ex | 3 +-- lib/mobilizon_web/resolvers/user.ex | 3 ++- lib/service/activity_pub/activity_pub.ex | 1 - lib/service/http_signatures/signature.ex | 9 +++++---- test/mobilizon/actors/actors_test.exs | 4 +--- 6 files changed, 10 insertions(+), 12 deletions(-) diff --git a/lib/mobilizon/actors/member.ex b/lib/mobilizon/actors/member.ex index 98951e6b3..b6963e546 100644 --- a/lib/mobilizon/actors/member.ex +++ b/lib/mobilizon/actors/member.ex @@ -8,7 +8,7 @@ defmodule Mobilizon.Actors.Member do import Ecto.Changeset alias Mobilizon.Actors.{Actor, Member, MemberRole} - + @type t :: %__MODULE__{ role: MemberRole.t(), parent: Actor.t(), diff --git a/lib/mobilizon/application.ex b/lib/mobilizon/application.ex index 5291896a8..19f3d9718 100644 --- a/lib/mobilizon/application.ex +++ b/lib/mobilizon/application.ex @@ -93,8 +93,7 @@ defmodule Mobilizon.Application do def named_version, do: @name <> " " <> @version def user_agent do - info = - "#{MobilizonWeb.Endpoint.url()} <#{Config.get([:instance, :email], "")}>" + info = "#{MobilizonWeb.Endpoint.url()} <#{Config.get([:instance, :email], "")}>" named_version() <> "; " <> info end diff --git a/lib/mobilizon_web/resolvers/user.ex b/lib/mobilizon_web/resolvers/user.ex index 5d954f35c..2f747abb3 100644 --- a/lib/mobilizon_web/resolvers/user.ex +++ b/lib/mobilizon_web/resolvers/user.ex @@ -112,7 +112,8 @@ defmodule MobilizonWeb.Resolvers.User do """ @spec create_user(any(), map(), any()) :: tuple() 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 Activation.send_confirmation_email(user) {:ok, user} diff --git a/lib/service/activity_pub/activity_pub.ex b/lib/service/activity_pub/activity_pub.ex index cccdae211..c0733c66e 100644 --- a/lib/service/activity_pub/activity_pub.ex +++ b/lib/service/activity_pub/activity_pub.ex @@ -113,7 +113,6 @@ defmodule Mobilizon.Service.ActivityPub do end end - @doc """ Getting an actor from url, eventually creating it """ diff --git a/lib/service/http_signatures/signature.ex b/lib/service/http_signatures/signature.ex index 0012ea02c..0eabf6325 100644 --- a/lib/service/http_signatures/signature.ex +++ b/lib/service/http_signatures/signature.ex @@ -16,16 +16,17 @@ defmodule Mobilizon.Service.HTTPSignatures.Signature do require Logger def key_id_to_actor_url(key_id) do - %{path: path} = uri = + %{path: path} = + uri = key_id |> URI.parse() |> Map.put(:fragment, nil) uri = - if not is_nil(path) do - Map.put(uri, :path, String.trim_trailing(path, "/publickey")) - else + if is_nil(path) do uri + else + Map.put(uri, :path, String.trim_trailing(path, "/publickey")) end URI.to_string(uri) diff --git a/test/mobilizon/actors/actors_test.exs b/test/mobilizon/actors/actors_test.exs index 7147cda41..7c211f472 100644 --- a/test/mobilizon/actors/actors_test.exs +++ b/test/mobilizon/actors/actors_test.exs @@ -157,9 +157,7 @@ defmodule Mobilizon.ActorsTest do event = insert(:event, organizer_actor: actor) event_found_id = - Actors.get_actor_by_name_with_preload( - "#{actor.preferred_username}@#{actor.domain}" - ).organized_events + Actors.get_actor_by_name_with_preload("#{actor.preferred_username}@#{actor.domain}").organized_events |> hd |> Map.get(:id)