Expose restricted names in nodeinfo.
authorlain <lain@soykaf.club>
Wed, 26 Dec 2018 11:46:16 +0000 (12:46 +0100)
committerlain <lain@soykaf.club>
Wed, 26 Dec 2018 11:46:16 +0000 (12:46 +0100)
lib/pleroma/web/nodeinfo/nodeinfo_controller.ex
test/web/node_info_test.exs

index 1265d81c54614ed7229874dc41b23bb540cebe90..a992f75f659314f21b04e6ab279bbec3bb46cfa6 100644 (file)
@@ -138,7 +138,8 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do
         },
         accountActivationRequired: Keyword.get(instance, :account_activation_required, false),
         invitesEnabled: Keyword.get(instance, :invites_enabled, false),
-        features: features
+        features: features,
+        restrictedNicknames: Pleroma.Config.get([Pleroma.User, :restricted_nicknames])
       }
     }
 
index 6769a4490d4cce362be3c11d91c395cdfab9b112..5981c70a727749ace802f99854e543a46b00659a 100644 (file)
@@ -19,6 +19,17 @@ defmodule Pleroma.Web.NodeInfoTest do
     assert user.ap_id in result["metadata"]["staffAccounts"]
   end
 
+  test "nodeinfo shows restricted nicknames", %{conn: conn} do
+    conn =
+      conn
+      |> get("/nodeinfo/2.0.json")
+
+    assert result = json_response(conn, 200)
+
+    assert Pleroma.Config.get([Pleroma.User, :restricted_nicknames]) ==
+             result["metadata"]["restrictedNicknames"]
+  end
+
   test "returns 404 when federation is disabled", %{conn: conn} do
     instance =
       Application.get_env(:pleroma, :instance)