mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-11-04 16:09:36 +00:00
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 @@ defmodule Pleroma.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