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

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2024-10-06 17:00:39 +02:00
parent d2eb4992e2
commit 0c41d986de
3 changed files with 10 additions and 1 deletions

View file

@ -0,0 +1 @@
Metadata: Do not include .atom feed links for remote accounts

View file

@ -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 @@ def build_tags(%{user: user}) do
], []}
]
end
def build_tags(_), do: []
end

View file

@ -15,4 +15,10 @@ test "it renders a link to user's atom feed" 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