logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://anongit.hacktivis.me/git/pleroma.git/
commit: 0c41d986de973bfae82794b6fe499f8261a2f6e9
parent d2eb4992e254c1cdc27033742de1958f02757df1
Author: marcin mikołajczak <git@mkljczk.pl>
Date:   Sun,  6 Oct 2024 17:00:39 +0200

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

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>

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