From: rinpatch Date: Mon, 7 Sep 2020 12:06:06 +0000 (+0300) Subject: Metadata: Move restriction check from Feed provider to activated_providers X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=0d2814ec8e41942cd5b056d9c1ed902be1e1773c;p=akkoma Metadata: Move restriction check from Feed provider to activated_providers --- diff --git a/lib/pleroma/web/metadata.ex b/lib/pleroma/web/metadata.ex index 68835c826..0f2d8d1e7 100644 --- a/lib/pleroma/web/metadata.ex +++ b/lib/pleroma/web/metadata.ex @@ -7,7 +7,6 @@ defmodule Pleroma.Web.Metadata do def build_tags(params) do providers = [ - Pleroma.Web.Metadata.Providers.Feed, Pleroma.Web.Metadata.Providers.RelMe, Pleroma.Web.Metadata.Providers.RestrictIndexing | activated_providers() @@ -47,7 +46,7 @@ defmodule Pleroma.Web.Metadata do defp activated_providers do unless Pleroma.Config.restrict_unauthenticated_access?(:activities, :local) do - Pleroma.Config.get([__MODULE__, :providers], []) + [Pleroma.Web.Metadata.Providers.Feed | Pleroma.Config.get([__MODULE__, :providers], [])] else [] end diff --git a/lib/pleroma/web/metadata/feed.ex b/lib/pleroma/web/metadata/feed.ex index dfe391b56..bd1459a17 100644 --- a/lib/pleroma/web/metadata/feed.ex +++ b/lib/pleroma/web/metadata/feed.ex @@ -11,17 +11,13 @@ defmodule Pleroma.Web.Metadata.Providers.Feed do @impl Provider def build_tags(%{user: user}) do - if Pleroma.Config.get!([:instance, :public]) do - [ - {:link, - [ - rel: "alternate", - type: "application/atom+xml", - href: Helpers.user_feed_path(Endpoint, :feed, user.nickname) <> ".atom" - ], []} - ] - else - [] - end + [ + {:link, + [ + rel: "alternate", + type: "application/atom+xml", + href: Helpers.user_feed_path(Endpoint, :feed, user.nickname) <> ".atom" + ], []} + ] end end diff --git a/test/web/metadata/metadata_test.exs b/test/web/metadata/metadata_test.exs index f7371cae2..9d3121b7b 100644 --- a/test/web/metadata/metadata_test.exs +++ b/test/web/metadata/metadata_test.exs @@ -24,10 +24,8 @@ defmodule Pleroma.Web.MetadataTest do end describe "no metadata for private instances" do - setup do: clear_config([:instance, :public]) - test "for local user" do - Pleroma.Config.put([:instance, :public], false) + clear_config([:instance, :public], false) user = insert(:user, bio: "This is my secret fedi account bio") assert "" = Pleroma.Web.Metadata.build_tags(%{user: user})