forked from potsda.mn/mobilizon
4b4ecec693
Signed-off-by: Thomas Citharel <tcit@tcit.fr> typo Signed-off-by: Thomas Citharel <tcit@tcit.fr> Rename avatar to avatar_url, same with header. Add a comment to explain why the tweak with HTTPoison and TLS1.2 Signed-off-by: Thomas Citharel <tcit@tcit.fr> Rename avatar to avatar_url Signed-off-by: Thomas Citharel <tcit@tcit.fr> rename old avatar properties in front-end to avatar_url Signed-off-by: Thomas Citharel <tcit@tcit.fr> fix change gravatar from ?d= to ?default= Signed-off-by: Thomas Citharel <tcit@tcit.fr> reorganize aliases and imports Signed-off-by: Thomas Citharel <tcit@tcit.fr> set avatar url only when gravatar exists, add a test for that case Signed-off-by: Thomas Citharel <tcit@tcit.fr>
51 lines
1.5 KiB
Elixir
51 lines
1.5 KiB
Elixir
defmodule EventosWeb.AccountView do
|
|
@moduledoc """
|
|
View for Accounts
|
|
"""
|
|
use EventosWeb, :view
|
|
alias EventosWeb.{AccountView, EventView}
|
|
|
|
def render("index.json", %{accounts: accounts}) do
|
|
%{data: render_many(accounts, AccountView, "acccount_basic.json")}
|
|
end
|
|
|
|
def render("show.json", %{account: account}) do
|
|
%{data: render_one(account, AccountView, "account.json")}
|
|
end
|
|
|
|
def render("show_basic.json", %{account: account}) do
|
|
%{data: render_one(account, AccountView, "account_basic.json")}
|
|
end
|
|
|
|
def render("acccount_basic.json", %{account: account}) do
|
|
%{id: account.id,
|
|
username: account.username,
|
|
domain: account.domain,
|
|
display_name: account.display_name,
|
|
description: account.description,
|
|
# public_key: account.public_key,
|
|
suspended: account.suspended,
|
|
uri: account.uri,
|
|
url: account.url,
|
|
avatar_url: account.avatar_url,
|
|
banner_url: account.banner_url,
|
|
}
|
|
end
|
|
|
|
def render("account.json", %{account: account}) do
|
|
%{id: account.id,
|
|
username: account.username,
|
|
domain: account.domain,
|
|
display_name: account.display_name,
|
|
description: account.description,
|
|
# public_key: account.public_key,
|
|
suspended: account.suspended,
|
|
uri: account.uri,
|
|
url: account.url,
|
|
avatar_url: account.avatar_url,
|
|
banner_url: account.banner_url,
|
|
organized_events: render_many(account.organized_events, EventView, "event_simple.json")
|
|
}
|
|
end
|
|
end
|