mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-23 17:54:22 +00:00
NodeInfo: Return safe_dm_mentions feature flag.
This commit is contained in:
parent
bf27190f7f
commit
e2afce34b6
|
@ -124,6 +124,9 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do
|
||||||
end,
|
end,
|
||||||
if Keyword.get(instance, :allow_relay) do
|
if Keyword.get(instance, :allow_relay) do
|
||||||
"relay"
|
"relay"
|
||||||
|
end,
|
||||||
|
if Keyword.get(instance, :safe_dm_mentions) do
|
||||||
|
"safe_dm_mentions"
|
||||||
end
|
end
|
||||||
]
|
]
|
||||||
|> Enum.filter(& &1)
|
|> Enum.filter(& &1)
|
||||||
|
|
|
@ -108,4 +108,27 @@ defmodule Pleroma.Web.NodeInfoTest do
|
||||||
assert result = json_response(conn, 200)
|
assert result = json_response(conn, 200)
|
||||||
assert Pleroma.Application.repository() == result["software"]["repository"]
|
assert Pleroma.Application.repository() == result["software"]["repository"]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "it returns the safe_dm_mentions feature if enabled", %{conn: conn} do
|
||||||
|
option = Pleroma.Config.get([:instance, :safe_dm_mentions])
|
||||||
|
Pleroma.Config.put([:instance, :safe_dm_mentions], true)
|
||||||
|
|
||||||
|
response =
|
||||||
|
conn
|
||||||
|
|> get("/nodeinfo/2.1.json")
|
||||||
|
|> json_response(:ok)
|
||||||
|
|
||||||
|
assert "safe_dm_mentions" in response["metadata"]["features"]
|
||||||
|
|
||||||
|
Pleroma.Config.put([:instance, :safe_dm_mentions], false)
|
||||||
|
|
||||||
|
response =
|
||||||
|
conn
|
||||||
|
|> get("/nodeinfo/2.1.json")
|
||||||
|
|> json_response(:ok)
|
||||||
|
|
||||||
|
refute "safe_dm_mentions" in response["metadata"]["features"]
|
||||||
|
|
||||||
|
Pleroma.Config.put([:instance, :safe_dm_mentions], option)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue