diff --git a/lib/pleroma/web/activity_pub/mrf/inline_quote_policy.ex b/lib/pleroma/web/activity_pub/mrf/inline_quote_policy.ex
index 46013fc5e..7de4935f2 100644
--- a/lib/pleroma/web/activity_pub/mrf/inline_quote_policy.ex
+++ b/lib/pleroma/web/activity_pub/mrf/inline_quote_policy.ex
@@ -6,8 +6,8 @@ defmodule Pleroma.Web.ActivityPub.MRF.InlineQuotePolicy do
@moduledoc "Force a quote line into the message content."
@behaviour Pleroma.Web.ActivityPub.MRF.Policy
- defp build_inline_quote(prefix, url, br) do
- "#{String.duplicate("
", br)}#{prefix}: #{url}"
+ defp build_inline_quote(prefix, url) do
+ "
#{prefix}: #{url}"
end
defp filter_object(%{"quoteUrl" => quote_url} = object) do
@@ -18,12 +18,13 @@ defmodule Pleroma.Web.ActivityPub.MRF.InlineQuotePolicy do
else
prefix = Pleroma.Config.get([:mrf_inline_quote, :prefix])
- inline_quote =
+ content =
if String.ends_with?(content, "
"),
- do: build_inline_quote(prefix, quote_url, 0),
- else: build_inline_quote(prefix, quote_url, 2)
+ do:
+ String.trim_trailing(content, "") <>
+ build_inline_quote(prefix, quote_url) <> "",
+ else: content <> build_inline_quote(prefix, quote_url)
- content = content <> inline_quote
Map.put(object, "content", content)
end
end
diff --git a/test/pleroma/web/activity_pub/mrf/inline_quote_policy_test.exs b/test/pleroma/web/activity_pub/mrf/inline_quote_policy_test.exs
index 8e75aaaab..2291c1dac 100644
--- a/test/pleroma/web/activity_pub/mrf/inline_quote_policy_test.exs
+++ b/test/pleroma/web/activity_pub/mrf/inline_quote_policy_test.exs
@@ -22,7 +22,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.InlineQuotePolicyTest do
{:ok, %{"object" => %{"content" => filtered}}} = InlineQuotePolicy.filter(activity)
assert filtered ==
- "Nice post
RT: https://gleasonator.com/objects/1234"
+ "Nice post
RT: https://gleasonator.com/objects/1234"
end
test "doesn't add line breaks to markdown posts" do
@@ -41,7 +41,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.InlineQuotePolicyTest do
{:ok, %{"object" => %{"content" => filtered}}} = InlineQuotePolicy.filter(activity)
assert filtered ==
- "Nice post
RT: https://gleasonator.com/objects/1234"
+ "Nice post
RT: https://gleasonator.com/objects/1234
"
end
test "ignores Misskey quote posts" do