1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.ActivityPub.MRF.InlineQuotePolicyTest do
6 alias Pleroma.Web.ActivityPub.MRF.InlineQuotePolicy
9 test "adds quote URL to post content" do
10 quote_url = "https://example.com/objects/1234"
14 "actor" => "https://example.com/users/alex",
17 "content" => "<p>Nice post</p>",
18 "quoteUri" => quote_url
22 {:ok, %{"object" => %{"content" => filtered}}} = InlineQuotePolicy.filter(activity)
25 "<p>Nice post<span class=\"quote-inline\"><br/><br/>RE: <a href=\"https://example.com/objects/1234\">https://example.com/objects/1234</a></span></p>"
28 test "ignores Misskey quote posts" do
29 object = File.read!("test/fixtures/quote_post/misskey_quote_post.json") |> Jason.decode!()
33 "actor" => "https://misskey.io/users/7rkrarq81i",
37 {:ok, filtered} = InlineQuotePolicy.filter(activity)
38 assert filtered == activity
41 test "ignores Fedibird quote posts" do
42 object = File.read!("test/fixtures/quote_post/fedibird_quote_post.json") |> Jason.decode!()
44 # Normally the ObjectValidator will fix this before it reaches MRF
45 object = Map.put(object, "quoteUrl", object["quoteURL"])
49 "actor" => "https://fedibird.com/users/noellabo",
53 {:ok, filtered} = InlineQuotePolicy.filter(activity)
54 assert filtered == activity