Merge branch 'fix-nginx-caching' into 'develop'
[akkoma] / lib / pleroma / web / activity_pub / mrf / no_placeholder_text_policy.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.ActivityPub.MRF.NoPlaceholderTextPolicy do
6 @behaviour Pleroma.Web.ActivityPub.MRF
7
8 @impl true
9 def filter(
10 %{
11 "type" => "Create",
12 "object" => %{"content" => content, "attachment" => _attachment} = child_object
13 } = object
14 )
15 when content in [".", "<p>.</p>"] do
16 child_object =
17 child_object
18 |> Map.put("content", "")
19
20 object =
21 object
22 |> Map.put("object", child_object)
23
24 {:ok, object}
25 end
26
27 @impl true
28 def filter(object), do: {:ok, object}
29 end