forked from AkkomaGang/akkoma
UtilController: Return state of safe dm mentions.
This commit is contained in:
parent
8468f3f6d4
commit
bf27190f7f
2 changed files with 26 additions and 1 deletions
|
@ -197,7 +197,9 @@ def config(conn, _params) do
|
||||||
vapidPublicKey: vapid_public_key,
|
vapidPublicKey: vapid_public_key,
|
||||||
accountActivationRequired:
|
accountActivationRequired:
|
||||||
if(Keyword.get(instance, :account_activation_required, false), do: "1", else: "0"),
|
if(Keyword.get(instance, :account_activation_required, false), do: "1", else: "0"),
|
||||||
invitesEnabled: if(Keyword.get(instance, :invites_enabled, false), do: "1", else: "0")
|
invitesEnabled: if(Keyword.get(instance, :invites_enabled, false), do: "1", else: "0"),
|
||||||
|
safeDMMentionsEnabled:
|
||||||
|
if(Pleroma.Config.get([:instance, :safe_dm_mentions]), do: "1", else: "0")
|
||||||
}
|
}
|
||||||
|
|
||||||
pleroma_fe =
|
pleroma_fe =
|
||||||
|
|
|
@ -75,6 +75,29 @@ test "it marks a single notification as read", %{conn: conn} do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET /api/statusnet/config.json" do
|
describe "GET /api/statusnet/config.json" do
|
||||||
|
test "returns the state of safe_dm_mentions flag", %{conn: conn} do
|
||||||
|
option = Pleroma.Config.get([:instance, :safe_dm_mentions])
|
||||||
|
Pleroma.Config.put([:instance, :safe_dm_mentions], true)
|
||||||
|
|
||||||
|
response =
|
||||||
|
conn
|
||||||
|
|> get("/api/statusnet/config.json")
|
||||||
|
|> json_response(:ok)
|
||||||
|
|
||||||
|
assert response["site"]["safeDMMentionsEnabled"] == "1"
|
||||||
|
|
||||||
|
Pleroma.Config.put([:instance, :safe_dm_mentions], false)
|
||||||
|
|
||||||
|
response =
|
||||||
|
conn
|
||||||
|
|> get("/api/statusnet/config.json")
|
||||||
|
|> json_response(:ok)
|
||||||
|
|
||||||
|
assert response["site"]["safeDMMentionsEnabled"] == "0"
|
||||||
|
|
||||||
|
Pleroma.Config.put([:instance, :safe_dm_mentions], option)
|
||||||
|
end
|
||||||
|
|
||||||
test "it returns the managed config", %{conn: conn} do
|
test "it returns the managed config", %{conn: conn} do
|
||||||
Pleroma.Config.put([:instance, :managed_config], false)
|
Pleroma.Config.put([:instance, :managed_config], false)
|
||||||
Pleroma.Config.put([:fe], theme: "rei-ayanami-towel")
|
Pleroma.Config.put([:fe], theme: "rei-ayanami-towel")
|
||||||
|
|
Loading…
Reference in a new issue