Remove credo and use mix format, and lint everything

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2018-07-27 10:45:35 +02:00
parent df3f08c528
commit 979aad5acb
104 changed files with 2278 additions and 1487 deletions

View File

@@ -34,16 +34,16 @@ defmodule EventosWeb.ActivityPub.ActorView do
"publicKeyPem" => public_key
},
"endpoints" => %{
"sharedInbox" => actor.shared_inbox_url,
},
# "icon" => %{
# "type" => "Image",
# "url" => User.avatar_url(actor)
# },
# "image" => %{
# "type" => "Image",
# "url" => User.banner_url(actor)
# }
"sharedInbox" => actor.shared_inbox_url
}
# "icon" => %{
# "type" => "Image",
# "url" => User.avatar_url(actor)
# },
# "image" => %{
# "type" => "Image",
# "url" => User.banner_url(actor)
# }
}
|> Map.merge(Utils.make_json_ld_header())
end
@@ -87,13 +87,14 @@ defmodule EventosWeb.ActivityPub.ActorView do
end
def render("outbox.json", %{actor: actor, page: page}) do
{page, no_page} = if page == 0 do
{1, true}
else
{page, false}
end
{page, no_page} =
if page == 0 do
{1, true}
else
{page, false}
end
{activities, total} = ActivityPub.fetch_public_activities_for_actor(actor, page)
{activities, total} = ActivityPub.fetch_public_activities_for_actor(actor, page)
collection =
Enum.map(activities, fn act ->
@@ -128,7 +129,12 @@ defmodule EventosWeb.ActivityPub.ActorView do
def render("activity.json", %{activity: %Activity{local: local} = activity}) do
%{
"id" => activity.data.url <> "/activity",
"type" => if local do "Create" else "Announce" end,
"type" =>
if local do
"Create"
else
"Announce"
end,
"actor" => activity.data.organizer_actor.url,
"published" => Timex.now(),
"to" => ["https://www.w3.org/ns/activitystreams#Public"],

View File

@@ -2,6 +2,7 @@ defmodule EventosWeb.ActivityPub.ObjectView do
use EventosWeb, :view
alias EventosWeb.ActivityPub.ObjectView
alias Eventos.Service.ActivityPub.Transmogrifier
@base %{
"@context" => [
"https://www.w3.org/ns/activitystreams",
@@ -17,8 +18,6 @@ defmodule EventosWeb.ActivityPub.ObjectView do
}
def render("event.json", %{event: event}) do
event = %{
"type" => "Event",
"id" => event.url,
@@ -27,8 +26,9 @@ defmodule EventosWeb.ActivityPub.ObjectView do
"content" => event.description,
"mediaType" => "text/markdown",
"published" => Timex.format!(event.inserted_at, "{ISO:Extended}"),
"updated" => Timex.format!(event.updated_at, "{ISO:Extended}"),
"updated" => Timex.format!(event.updated_at, "{ISO:Extended}")
}
Map.merge(event, @base)
end