mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-29 16:56:52 +00:00
Metadata: Move restriction check from Feed provider to activated_providers
This commit is contained in:
parent
2011142ed9
commit
0d2814ec8e
|
@ -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
|
||||
|
|
|
@ -11,7 +11,6 @@ defmodule Pleroma.Web.Metadata.Providers.Feed do
|
|||
|
||||
@impl Provider
|
||||
def build_tags(%{user: user}) do
|
||||
if Pleroma.Config.get!([:instance, :public]) do
|
||||
[
|
||||
{:link,
|
||||
[
|
||||
|
@ -20,8 +19,5 @@ defmodule Pleroma.Web.Metadata.Providers.Feed do
|
|||
href: Helpers.user_feed_path(Endpoint, :feed, user.nickname) <> ".atom"
|
||||
], []}
|
||||
]
|
||||
else
|
||||
[]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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})
|
||||
|
|
Loading…
Reference in a new issue