Expose restricted names in nodeinfo.

This commit is contained in:
lain 2018-12-26 12:46:16 +01:00
parent 91724d160a
commit 551d80cc01
2 changed files with 13 additions and 1 deletions

View file

@ -138,7 +138,8 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do
}, },
accountActivationRequired: Keyword.get(instance, :account_activation_required, false), accountActivationRequired: Keyword.get(instance, :account_activation_required, false),
invitesEnabled: Keyword.get(instance, :invites_enabled, false), invitesEnabled: Keyword.get(instance, :invites_enabled, false),
features: features features: features,
restrictedNicknames: Pleroma.Config.get([Pleroma.User, :restricted_nicknames])
} }
} }

View file

@ -19,6 +19,17 @@ defmodule Pleroma.Web.NodeInfoTest do
assert user.ap_id in result["metadata"]["staffAccounts"] assert user.ap_id in result["metadata"]["staffAccounts"]
end 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 test "returns 404 when federation is disabled", %{conn: conn} do
instance = instance =
Application.get_env(:pleroma, :instance) Application.get_env(:pleroma, :instance)