Merge branch 'safe-mentions' into 'develop'

NodeInfo: Return safe_dm_mentions feature flag.

See merge request pleroma/pleroma!964
This commit is contained in:
lambda 2019-03-22 11:03:56 +00:00
commit fee360e581
2 changed files with 26 additions and 0 deletions

View file

@ -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)

View file

@ -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