diff options
| author | Alex Gleason <alex@alexgleason.me> | 2022-01-26 11:49:31 -0600 | 
|---|---|---|
| committer | tusooa <tusooa@kazv.moe> | 2023-09-13 19:19:04 -0400 | 
| commit | 6f11f11519f9c735f6b059c250f4bf01e09b305f (patch) | |
| tree | aa9491d11ff486fbe50ca9ed8ec989bf6b8b826d /test | |
| parent | 59326247aa754991add9170e204257a8bf94c40f (diff) | |
| download | pleroma-6f11f11519f9c735f6b059c250f4bf01e09b305f.tar.gz pleroma-6f11f11519f9c735f6b059c250f4bf01e09b305f.zip | |
StatusView: fix quote visibility
Diffstat (limited to 'test')
| -rw-r--r-- | test/pleroma/web/mastodon_api/views/status_view_test.exs | 41 | 
1 files changed, 41 insertions, 0 deletions
| diff --git a/test/pleroma/web/mastodon_api/views/status_view_test.exs b/test/pleroma/web/mastodon_api/views/status_view_test.exs index f50b02799..f41ef580d 100644 --- a/test/pleroma/web/mastodon_api/views/status_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/status_view_test.exs @@ -446,6 +446,47 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do      assert status.pleroma.quote.id == to_string(quote_post.id)    end +  test "quoted private post" do +    user = insert(:user) + +    # Insert a private post +    private = insert(:followers_only_note_activity, user: user) +    private_object = Object.normalize(private) + +    # Create a public post quoting the private post +    quote_private = +      insert(:note_activity, note: insert(:note, data: %{"quoteUrl" => private_object.data["id"]})) + +    status = StatusView.render("show.json", %{activity: quote_private}) + +    # The quote isn't rendered +    refute status.pleroma.quote +    assert status.pleroma.quote_url == private_object.data["id"] + +    # After following the user, the quote is rendered +    follower = insert(:user) +    CommonAPI.follow(follower, user) + +    status = StatusView.render("show.json", %{activity: quote_private, for: follower}) +    assert status.pleroma.quote.id == to_string(private.id) +  end + +  test "quoted direct message" do +    # Insert a direct message +    direct = insert(:direct_note_activity) +    direct_object = Object.normalize(direct) + +    # Create a public post quoting the direct message +    quote_direct = +      insert(:note_activity, note: insert(:note, data: %{"quoteUrl" => direct_object.data["id"]})) + +    status = StatusView.render("show.json", %{activity: quote_direct}) + +    # The quote isn't rendered +    refute status.pleroma.quote +    assert status.pleroma.quote_url == direct_object.data["id"] +  end +    test "contains mentions" do      user = insert(:user)      mentioned = insert(:user) | 
