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
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