mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-18 07:04:44 +00:00
Merge branch 'safe-mentions' into 'develop'
NodeInfo: Return safe_dm_mentions feature flag. See merge request pleroma/pleroma!964
This commit is contained in:
commit
fee360e581
2 changed files with 26 additions and 0 deletions
|
@ -124,6 +124,9 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do
|
|||
end,
|
||||
if Keyword.get(instance, :allow_relay) do
|
||||
"relay"
|
||||
end,
|
||||
if Keyword.get(instance, :safe_dm_mentions) do
|
||||
"safe_dm_mentions"
|
||||
end
|
||||
]
|
||||
|> Enum.filter(& &1)
|
||||
|
|
|
@ -108,4 +108,27 @@ defmodule Pleroma.Web.NodeInfoTest do
|
|||
assert result = json_response(conn, 200)
|
||||
assert Pleroma.Application.repository() == result["software"]["repository"]
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue