From: William Pitcock Date: Thu, 25 Oct 2018 04:01:59 +0000 (+0000) Subject: user: add helper for fetching profile url (which may be different than ap id) X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=1b480e351405a4f987e0ba21bfe845cef7ff36de;p=akkoma user: add helper for fetching profile url (which may be different than ap id) --- diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index e97224731..0c9fa559a 100644 --- 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