Use the akkoma-fe frontend url for linking to the current post

this was already done for other posts, but it is also required for
proper discord embeds when authorized fetch is enabled
This commit is contained in:
Charlotte 🦝 Deleńkec 2025-03-23 09:00:37 +01:00
parent eda8a8bd11
commit d9098949de
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122

View file

@ -24,6 +24,14 @@ def show(%{assigns: %{notice_id: notice_id}} = conn, _params) do
true <- Visibility.is_public?(activity.object),
{_, true} <- {:visible?, Visibility.visible_for_user?(activity, _reading_user = nil)},
%User{} = user <- User.get_by_ap_id(activity.object.data["actor"]) do
url = case user.local do
# Workaround 1: Discord expects a /notice/#{activity} URL for fetching posts with AP signing on
# Workaround 2: Due to a Discord bug, this cannot be a relative URL
true -> url(~p[/notice/#{activity}])
_ -> activity.data["url"] || activity.data["external_url"] || activity.data["id"]
end
meta =
Metadata.build_tags(%{
activity_id: notice_id,