forked from AkkomaGang/akkoma
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:
parent
eda8a8bd11
commit
d9098949de
1 changed files with 8 additions and 0 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue