List messages must be visible for mentioned users
[akkoma] / lib / pleroma / web / nodeinfo / nodeinfo_controller.ex
index 869dda5c5cd3d44eac41aa853ff23d92b1332e8e..a1d7fcc7dae34a046acebca76db2a72cc29ba7e1 100644 (file)
@@ -34,8 +34,11 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do
   def raw_nodeinfo do
     stats = Stats.get_stats()
 
+    exclusions = Config.get([:instance, :mrf_transparency_exclusions])
+
     mrf_simple =
       Config.get(:mrf_simple)
+      |> Enum.map(fn {k, v} -> {k, Enum.reject(v, fn v -> v in exclusions end)} end)
       |> Enum.into(%{})
 
     # This horror is needed to convert regex sigils to strings
@@ -86,7 +89,8 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do
           mrf_simple: mrf_simple,
           mrf_keyword: mrf_keyword,
           mrf_user_allowlist: mrf_user_allowlist,
-          quarantined_instances: quarantined
+          quarantined_instances: quarantined,
+          exclusions: length(exclusions) > 0
         }
       else
         %{}
@@ -201,8 +205,6 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do
   end
 
   def nodeinfo(conn, _) do
-    conn
-    |> put_status(404)
-    |> json(%{error: "Nodeinfo schema version not handled"})
+    render_error(conn, :not_found, "Nodeinfo schema version not handled")
   end
 end