user: add helper for fetching profile url (which may be different than ap id)
This commit is contained in:
parent
a8137159c2
commit
1b480e3514
1 changed files with 4 additions and 0 deletions
|
@ -42,6 +42,10 @@ def banner_url(user) do
|
|||
end
|
||||
end
|
||||
|
||||
def profile_url(%User{info: %{"source_data" => %{"url" => url}}}), do: url
|
||||
def profile_url(%User{ap_id: ap_id}), do: ap_id
|
||||
def profile_url(_), do: nil
|
||||
|
||||
def ap_id(%User{nickname: nickname}) do
|
||||
"#{Web.base_url()}/users/#{nickname}"
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue