@@ -17,6 +17,7 @@ defmodule Mobilizon.Web.ActivityPub.ActorView do
|
||||
@json_ld_header Utils.make_json_ld_header()
|
||||
@selected_member_roles ~w(creator administrator moderator member)a
|
||||
|
||||
@spec render(String.t(), map()) :: map()
|
||||
def render("actor.json", %{actor: actor}) do
|
||||
actor
|
||||
|> Convertible.model_to_as()
|
||||
|
||||
@@ -3,6 +3,7 @@ defmodule Mobilizon.Web.ActivityPub.ObjectView do
|
||||
|
||||
alias Mobilizon.Federation.ActivityPub.{Activity, Utils}
|
||||
|
||||
@spec render(String.t(), map()) :: map()
|
||||
def render("activity.json", %{activity: %Activity{local: local, data: data} = activity}) do
|
||||
%{
|
||||
"id" => data["id"],
|
||||
|
||||
@@ -8,6 +8,7 @@ defmodule Mobilizon.Web.AuthView do
|
||||
alias Phoenix.HTML.Tag
|
||||
import Mobilizon.Web.Views.Utils
|
||||
|
||||
@spec render(String.t(), map()) :: String.t() | Plug.Conn.t()
|
||||
def render("callback.html", %{
|
||||
conn: conn,
|
||||
access_token: access_token,
|
||||
|
||||
@@ -8,6 +8,7 @@ defmodule Mobilizon.Web.ErrorHelpers do
|
||||
@doc """
|
||||
Translates an error message using gettext.
|
||||
"""
|
||||
@spec translate_error({msg :: String.t(), opts :: map()}) :: String.t()
|
||||
def translate_error({msg, opts}) do
|
||||
# Because error messages were defined within Ecto, we must
|
||||
# call the Gettext module passing our Gettext backend. We
|
||||
|
||||
@@ -6,6 +6,7 @@ defmodule Mobilizon.Web.ErrorView do
|
||||
alias Mobilizon.Service.Metadata.Instance
|
||||
import Mobilizon.Web.Views.Utils
|
||||
|
||||
@spec render(String.t(), map()) :: map() | String.t() | Plug.Conn.t()
|
||||
def render("404.html", %{conn: conn}) do
|
||||
with tags <- Instance.build_tags(),
|
||||
{:ok, html} <- inject_tags(tags, get_locale(conn)) do
|
||||
|
||||
@@ -8,6 +8,7 @@ defmodule Mobilizon.Web.JsonLD.ObjectView do
|
||||
alias Mobilizon.Web.Endpoint
|
||||
alias Mobilizon.Web.JsonLD.ObjectView
|
||||
|
||||
@spec render(String.t(), map()) :: map()
|
||||
def render("group.json", %{group: %Actor{} = group}) do
|
||||
%{
|
||||
"@context" => "http://schema.org",
|
||||
@@ -93,6 +94,7 @@ defmodule Mobilizon.Web.JsonLD.ObjectView do
|
||||
}
|
||||
end
|
||||
|
||||
@spec render_location(map()) :: map() | nil
|
||||
defp render_location(%{physical_address: %Address{} = address}),
|
||||
do: render_one(address, ObjectView, "place.json", as: :address)
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@ defmodule Mobilizon.Web.PageView do
|
||||
alias Mobilizon.Federation.ActivityStream.Convertible
|
||||
import Mobilizon.Web.Views.Utils
|
||||
|
||||
@doc false
|
||||
@spec render(String.t(), %{conn: Plug.Conn.t()}) :: map() | String.t() | Plug.Conn.t()
|
||||
def render("actor.activity-json", %{conn: %{assigns: %{object: %Actor{} = actor}}}) do
|
||||
actor
|
||||
|> Convertible.model_to_as()
|
||||
|
||||
Reference in New Issue
Block a user