Add nodes and privileges to nodeinfo
I didn't add it to /api/v1/instance I was wondering if I should, but since it e.g. also didn't show staff, it felt better not to
This commit is contained in:
parent
211e561e2a
commit
4e4eb81749
|
@ -49,6 +49,10 @@ def get_nodeinfo("2.0") do
|
|||
enabled: false
|
||||
},
|
||||
staffAccounts: staff_accounts,
|
||||
roles: %{
|
||||
admin: Config.get([:instance, :admin_privileges]),
|
||||
moderator: Config.get([:instance, :moderator_privileges])
|
||||
},
|
||||
federation: federation,
|
||||
pollLimits: Config.get([:instance, :poll_limits]),
|
||||
postFormats: Config.get([:instance, :allowed_post_formats]),
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Web.NodeInfoTest do
|
||||
use Pleroma.Web.ConnCase
|
||||
use Pleroma.Web.ConnCase, async: false
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
|
@ -40,6 +40,19 @@ test "nodeinfo shows staff accounts", %{conn: conn} do
|
|||
assert admin.ap_id in result["metadata"]["staffAccounts"]
|
||||
end
|
||||
|
||||
test "nodeinfo shows roles and privileges", %{conn: conn} do
|
||||
clear_config([:instance, :moderator_privileges], [:cofe])
|
||||
clear_config([:instance, :admin_privileges], [:suya, :cofe])
|
||||
|
||||
conn =
|
||||
conn
|
||||
|> get("/nodeinfo/2.1.json")
|
||||
|
||||
assert result = json_response(conn, 200)
|
||||
|
||||
assert %{"admin" => ["suya", "cofe"], "moderator" => ["cofe"]} == result["metadata"]["roles"]
|
||||
end
|
||||
|
||||
test "nodeinfo shows restricted nicknames", %{conn: conn} do
|
||||
conn =
|
||||
conn
|
||||
|
|
Loading…
Reference in New Issue