mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-23 01:35:28 +00:00
Add publicTimelineVisibility to nodeinfo
This commit is contained in:
parent
377d1483b6
commit
9464d50562
|
@ -89,7 +89,11 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do
|
|||
features: features,
|
||||
restrictedNicknames: Config.get([Pleroma.User, :restricted_nicknames]),
|
||||
skipThreadContainment: Config.get([:instance, :skip_thread_containment], false),
|
||||
localBubbleInstances: Config.get([:instance, :local_bubble], [])
|
||||
localBubbleInstances: Config.get([:instance, :local_bubble], []),
|
||||
publicTimelineVisibility: %{
|
||||
federated: !Config.restrict_unauthenticated_access?(:timelines, :federated),
|
||||
local: !Config.restrict_unauthenticated_access?(:timelines, :local)
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
|
|
@ -292,4 +292,34 @@ defmodule Pleroma.Web.NodeInfoTest do
|
|||
assert response["metadata"]["federation"]["mrf_simple_info"] == expected_config
|
||||
end
|
||||
end
|
||||
|
||||
describe "public timeline visibility" do
|
||||
test "shows public timeline visibility", %{conn: conn} do
|
||||
clear_config([:restrict_unauthenticated, :timelines], %{local: false, federated: false})
|
||||
response =
|
||||
conn
|
||||
|> get("/nodeinfo/2.1.json")
|
||||
|> json_response(:ok)
|
||||
|
||||
assert response["metadata"]["publicTimelineVisibility"]["local"] == true
|
||||
assert response["metadata"]["publicTimelineVisibility"]["federated"] == true
|
||||
|
||||
clear_config([:restrict_unauthenticated, :timelines], %{local: true, federated: false})
|
||||
response =
|
||||
conn
|
||||
|> get("/nodeinfo/2.1.json")
|
||||
|> json_response(:ok)
|
||||
assert response["metadata"]["publicTimelineVisibility"]["local"] == false
|
||||
assert response["metadata"]["publicTimelineVisibility"]["federated"] == true
|
||||
|
||||
clear_config([:restrict_unauthenticated, :timelines], %{local: false, federated: true})
|
||||
response =
|
||||
conn
|
||||
|> get("/nodeinfo/2.1.json")
|
||||
|> json_response(:ok)
|
||||
|
||||
assert response["metadata"]["publicTimelineVisibility"]["local"] == true
|
||||
assert response["metadata"]["publicTimelineVisibility"]["federated"] == false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue