forked from AkkomaGang/akkoma
Add publicTimelineVisibility to nodeinfo
This commit is contained in:
parent
377d1483b6
commit
9464d50562
2 changed files with 35 additions and 1 deletions
|
@ -89,7 +89,11 @@ def raw_nodeinfo 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 @@ test "shows extra information in the mrf_simple_info field for relevant entries"
|
|||
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