Add key- and valuePlaceholders for quarantined_instances and mrf_simple
authorIlja <domainepublic@spectraltheorem.be>
Fri, 18 Dec 2020 13:29:38 +0000 (14:29 +0100)
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Fri, 6 Aug 2021 05:59:53 +0000 (07:59 +0200)
* I also added for keywordpolicy as well now. It was done in the admin-fe, but is better to be done here
* I also added comments to explain why we did the _info keys (backwards compatibility)

config/description.exs
lib/pleroma/web/activity_pub/mrf/keyword_policy.ex
lib/pleroma/web/activity_pub/mrf/simple_policy.ex
lib/pleroma/web/mastodon_api/views/instance_view.ex

index 252aa63d89cd90bf9c7fcb410e8d2c05cde0df1e..411029c278a830a55a2be3c14dd61efbcfe897f3 100644 (file)
@@ -688,6 +688,8 @@ config :pleroma, :config_description, [
       %{
         key: :quarantined_instances,
         type: {:list, :tuple},
+        keyPlaceholder: "instance",
+        valuePlaceholder: "reason",
         description:
           "List of ActivityPub instances where private (DMs, followers-only) activities will not be sent and the reason for doing so",
         suggestions: [
index 646008dd9abb5b033e9516b48fddf8afdcf1cdd8..aebf78b4673a80a189bef2c3bcb1e50c5e002ff8 100644 (file)
@@ -159,6 +159,8 @@ defmodule Pleroma.Web.ActivityPub.MRF.KeywordPolicy do
         %{
           key: :replace,
           type: {:list, :tuple},
+          keyPlaceholder: "pattern",
+          valuePlaceholder: "replacement",
           description: """
             **Pattern**: a string or [Regex](https://hexdocs.pm/elixir/Regex.html) in the format of `~r/PATTERN/`.
 
index 22999ef581324589928b2aaf33ea9351149552d3..00a74ead823b3e2d79cf6213aed7b83a1b8b0b86 100644 (file)
@@ -271,6 +271,10 @@ defmodule Pleroma.Web.ActivityPub.MRF.SimplePolicy do
       end)
       |> Enum.into(%{})
 
+    # This is for backwards compatibility. We originally didn't sent
+    # extra info like a reason why an instance was rejected/quarantined/etc.
+    # Because we didn't want to break backwards compatibility it was decided
+    # to add an extra "info" key.
     mrf_simple_info =
       mrf_simple_excluded
       |> Enum.map(fn {k, v} -> {k, Enum.reject(v, fn {_, reason} -> reason == "" end)} end)
index a341ca6f4a4f11eb1a860ff685f22e311664903e..f62b52a6433b5dd9984a4c2e0c26dcef6fb98d05 100644 (file)
@@ -100,6 +100,10 @@ defmodule Pleroma.Web.MastodonAPI.InstanceView do
           quarantined
           |> Enum.map(fn {instance, _reason} -> instance end)
       })
+      # This is for backwards compatibility. We originally didn't sent
+      # extra info like a reason why an instance was rejected/quarantined/etc.
+      # Because we didn't want to break backwards compatibility it was decided
+      # to add an extra "info" key.
       |> Map.merge(%{
         quarantined_instances_info: %{
           "quarantined_instances" =>