2019-01-14 05:31:57 +00:00
|
|
|
# Pleroma: A lightweight social networking server
|
|
|
|
# Copyright © 2019 Pleroma Authors <https://pleroma.social/>
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
defmodule Pleroma.Web.ActivityPub.MRF.NoPlaceholderTextPolicy do
|
2019-05-06 02:28:04 +00:00
|
|
|
@moduledoc "Ensure no content placeholder is present (such as the dot from mastodon)"
|
2019-01-14 05:31:57 +00:00
|
|
|
@behaviour Pleroma.Web.ActivityPub.MRF
|
|
|
|
|
|
|
|
@impl true
|
|
|
|
def filter(
|
|
|
|
%{
|
|
|
|
"type" => "Create",
|
2019-07-10 05:12:21 +00:00
|
|
|
"object" => %{"content" => content, "attachment" => _} = _child_object
|
2019-01-14 05:31:57 +00:00
|
|
|
} = object
|
|
|
|
)
|
|
|
|
when content in [".", "<p>.</p>"] do
|
2019-07-10 05:12:21 +00:00
|
|
|
{:ok, put_in(object, ["object", "content"], "")}
|
2019-01-14 05:31:57 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
@impl true
|
|
|
|
def filter(object), do: {:ok, object}
|
|
|
|
end
|