From 1b480e351405a4f987e0ba21bfe845cef7ff36de Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Thu, 25 Oct 2018 04:01:59 +0000 Subject: [PATCH] user: add helper for fetching profile url (which may be different than ap id) --- lib/pleroma/user.ex | 4 ++++ 1 file changed, 4 insertions(+) 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 -- 2.45.2