From 7e137d1a1c0b4877490007020286d4620fa431b6 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 11 Oct 2018 17:47:02 +0200 Subject: [PATCH] Format Signed-off-by: Thomas Citharel --- lib/mobilizon/actors/actor.ex | 5 ++++- lib/mobilizon_web/controllers/activity_pub_controller.ex | 3 ++- lib/mobilizon_web/controllers/group_controller.ex | 4 +++- lib/mobilizon_web/controllers/page_controller.ex | 4 ++-- lib/service/activity_pub/activity_pub.ex | 5 ++++- test/eventos_web/controllers/nodeinfo_controller_test.exs | 6 +++++- 6 files changed, 20 insertions(+), 7 deletions(-) diff --git a/lib/mobilizon/actors/actor.ex b/lib/mobilizon/actors/actor.ex index 72dafecb8..4fae33677 100644 --- a/lib/mobilizon/actors/actor.ex +++ b/lib/mobilizon/actors/actor.ex @@ -96,7 +96,10 @@ defmodule Mobilizon.Actors.Actor do |> unique_constraint(:preferred_username, name: :actors_preferred_username_domain_index) |> put_change(:url, "#{MobilizonWeb.Endpoint.url()}/@#{attrs.preferred_username}") |> put_change(:inbox_url, "#{MobilizonWeb.Endpoint.url()}/@#{attrs.preferred_username}/inbox") - |> put_change(:outbox_url, "#{MobilizonWeb.Endpoint.url()}/@#{attrs.preferred_username}/outbox") + |> put_change( + :outbox_url, + "#{MobilizonWeb.Endpoint.url()}/@#{attrs.preferred_username}/outbox" + ) |> put_change(:shared_inbox_url, "#{MobilizonWeb.Endpoint.url()}/inbox") |> validate_required([:preferred_username, :keys, :suspended, :url, :type]) end diff --git a/lib/mobilizon_web/controllers/activity_pub_controller.ex b/lib/mobilizon_web/controllers/activity_pub_controller.ex index 40963cc0f..68ad77068 100644 --- a/lib/mobilizon_web/controllers/activity_pub_controller.ex +++ b/lib/mobilizon_web/controllers/activity_pub_controller.ex @@ -12,10 +12,11 @@ defmodule MobilizonWeb.ActivityPubController do def actor(conn, %{"name" => name}) do with %Actor{} = actor <- Actors.get_local_actor_by_name(name) do case get_req_header(conn, "accept") do - ["application/activity+json"] -> + ["application/activity+json"] -> conn |> put_resp_header("content-type", "application/activity+json") |> json(ActorView.render("actor.json", %{actor: actor})) + _ -> conn |> put_resp_content_type("text/html") diff --git a/lib/mobilizon_web/controllers/group_controller.ex b/lib/mobilizon_web/controllers/group_controller.ex index 2318cf60c..95d14f54b 100644 --- a/lib/mobilizon_web/controllers/group_controller.ex +++ b/lib/mobilizon_web/controllers/group_controller.ex @@ -41,7 +41,9 @@ defmodule MobilizonWeb.GroupController do nil -> conn |> put_status(:not_found) - |> render(MobilizonWeb.ErrorView, "not_found.json", details: "group or actor doesn't exist") + |> render(MobilizonWeb.ErrorView, "not_found.json", + details: "group or actor doesn't exist" + ) err -> require Logger diff --git a/lib/mobilizon_web/controllers/page_controller.ex b/lib/mobilizon_web/controllers/page_controller.ex index 3d27f512d..c68f79bf6 100644 --- a/lib/mobilizon_web/controllers/page_controller.ex +++ b/lib/mobilizon_web/controllers/page_controller.ex @@ -8,7 +8,7 @@ defmodule MobilizonWeb.PageController do def index(conn, _params) do conn - |> put_resp_content_type("text/html") - |> send_file(200, "priv/static/index.html") + |> put_resp_content_type("text/html") + |> send_file(200, "priv/static/index.html") end end diff --git a/lib/service/activity_pub/activity_pub.ex b/lib/service/activity_pub/activity_pub.ex index 40919803b..d458dcfc2 100644 --- a/lib/service/activity_pub/activity_pub.ex +++ b/lib/service/activity_pub/activity_pub.ex @@ -261,7 +261,10 @@ defmodule Mobilizon.Service.ActivityPub do host = URI.parse(inbox).host signature = - Mobilizon.Service.HTTPSignatures.sign(actor, %{host: host, "content-length": byte_size(json)}) + Mobilizon.Service.HTTPSignatures.sign(actor, %{ + host: host, + "content-length": byte_size(json) + }) Logger.debug("signature") Logger.debug(inspect(signature)) diff --git a/test/eventos_web/controllers/nodeinfo_controller_test.exs b/test/eventos_web/controllers/nodeinfo_controller_test.exs index 003c82649..96ea216f3 100644 --- a/test/eventos_web/controllers/nodeinfo_controller_test.exs +++ b/test/eventos_web/controllers/nodeinfo_controller_test.exs @@ -10,7 +10,11 @@ defmodule MobilizonWeb.NodeinfoControllerTest do "links" => [ %{ "href" => - MobilizonWeb.Router.Helpers.nodeinfo_url(MobilizonWeb.Endpoint, :nodeinfo, "2.0"), + MobilizonWeb.Router.Helpers.nodeinfo_url( + MobilizonWeb.Endpoint, + :nodeinfo, + "2.0" + ), "rel" => "http://nodeinfo.diaspora.software/ns/schema/2.0" } ]