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

View File

@ -108,4 +108,27 @@ test "returns software.repository field in nodeinfo 2.1", %{conn: conn} 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