user: add helper for fetching profile url (which may be different than ap id)
This commit is contained in:
parent
a8137159c2
commit
1b480e3514
|
@ -42,6 +42,10 @@ def banner_url(user) do
|
||||||
end
|
end
|
||||||
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
|
def ap_id(%User{nickname: nickname}) do
|
||||||
"#{Web.base_url()}/users/#{nickname}"
|
"#{Web.base_url()}/users/#{nickname}"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue