logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://anongit.hacktivis.me/git/pleroma.git/
commit: ee3ab8b625ccb26aa633276c1676a077e3b155d4
parent f7bf9a8c8f822b950808e6bf54c9c63923af7466
Author: lain <lain@soykaf.club>
Date:   Tue, 12 Nov 2024 09:44:29 +0000

Merge branch 'atom-tag' into 'develop'

Metadata: Do not include .atom feed links for remote accounts

See merge request pleroma/pleroma!4281

Diffstat:

Achangelog.d/atom-tag.change1+
Mlib/pleroma/web/metadata/providers/feed.ex4+++-
Mtest/pleroma/web/metadata/providers/feed_test.exs6++++++
3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/changelog.d/atom-tag.change b/changelog.d/atom-tag.change @@ -0,0 +1 @@ +Metadata: Do not include .atom feed links for remote accounts diff --git a/lib/pleroma/web/metadata/providers/feed.ex b/lib/pleroma/web/metadata/providers/feed.ex @@ -10,7 +10,7 @@ defmodule Pleroma.Web.Metadata.Providers.Feed do @behaviour Provider @impl Provider - def build_tags(%{user: user}) do + def build_tags(%{user: %{local: true} = user}) do [ {:link, [ @@ -20,4 +20,6 @@ defmodule Pleroma.Web.Metadata.Providers.Feed do ], []} ] end + + def build_tags(_), do: [] end diff --git a/test/pleroma/web/metadata/providers/feed_test.exs b/test/pleroma/web/metadata/providers/feed_test.exs @@ -15,4 +15,10 @@ defmodule Pleroma.Web.Metadata.Providers.FeedTest do [rel: "alternate", type: "application/atom+xml", href: "/users/lain/feed.atom"], []} ] end + + test "it doesn't render a link to remote user's feed" do + user = insert(:user, nickname: "lain@lain.com", local: false) + + assert Feed.build_tags(%{user: user}) == [] + end end