projects
/
akkoma
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a813715
)
user: add helper for fetching profile url (which may be different than ap id)
author
William Pitcock
<nenolod@dereferenced.org>
Thu, 25 Oct 2018 04:01:59 +0000
(
04:01
+0000)
committer
William Pitcock
<nenolod@dereferenced.org>
Thu, 25 Oct 2018 04:01:59 +0000
(
04:01
+0000)
lib/pleroma/user.ex
patch
|
blob
|
history
diff --git
a/lib/pleroma/user.ex
b/lib/pleroma/user.ex
index e972247316c0ad7aed9acf6b6f06857be3133691..0c9fa559a21944c3bf29aa98d6aa7fce2296a8c5 100644
(file)
--- a/
lib/pleroma/user.ex
+++ b/
lib/pleroma/user.ex
@@
-42,6
+42,10
@@
defmodule Pleroma.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