diff options
author | feld <feld@feld.me> | 2024-09-06 13:27:06 +0000 |
---|---|---|
committer | feld <feld@feld.me> | 2024-09-06 13:27:06 +0000 |
commit | 2c916ccd89ee6d0f4dbf05d39374f0c27237d5d7 (patch) | |
tree | e98d505905285c52aba3d82ba8eb9995ca2af2a0 /test | |
parent | 25db1a5d671e64e18af2d49e397438213419aef6 (diff) | |
parent | 5f573b4095ade584a590b756c83f13f89336cd04 (diff) | |
download | pleroma-2c916ccd89ee6d0f4dbf05d39374f0c27237d5d7.tar.gz pleroma-2c916ccd89ee6d0f4dbf05d39374f0c27237d5d7.zip |
Merge branch 'following-state-bug' into 'develop'
Fix Following status bug
See merge request pleroma/pleroma!4251
Diffstat (limited to 'test')
-rw-r--r-- | test/pleroma/web/mastodon_api/views/account_view_test.exs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/pleroma/web/mastodon_api/views/account_view_test.exs b/test/pleroma/web/mastodon_api/views/account_view_test.exs index dca64853d..f88b90955 100644 --- a/test/pleroma/web/mastodon_api/views/account_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/account_view_test.exs @@ -456,6 +456,45 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do test_relationship_rendering(user, other_user, expected) end + test "relationship does not indicate following if a FollowingRelationship is missing" do + user = insert(:user) + other_user = insert(:user, local: false) + + # Create a follow relationship with the real Follow Activity and Accept it + assert {:ok, _, _, _} = CommonAPI.follow(other_user, user) + assert {:ok, _} = CommonAPI.accept_follow_request(user, other_user) + + assert %{data: %{"state" => "accept"}} = + Pleroma.Web.ActivityPub.Utils.fetch_latest_follow(user, other_user) + + # Fetch the relationship and forcibly delete it to simulate + # a Follow Accept that did not complete processing + %{following_relationships: [relationship]} = + Pleroma.UserRelationship.view_relationships_option(user, [other_user]) + + assert {:ok, _} = Pleroma.Repo.delete(relationship) + + assert %{following_relationships: [], user_relationships: []} == + Pleroma.UserRelationship.view_relationships_option(user, [other_user]) + + expected = + Map.merge( + @blank_response, + %{ + following: false, + followed_by: false, + muting: false, + muting_notifications: false, + subscribing: false, + notifying: false, + showing_reblogs: true, + id: to_string(other_user.id) + } + ) + + test_relationship_rendering(user, other_user, expected) + end + test "represent a relationship for the blocking and blocked user" do user = insert(:user) other_user = insert(:user) |