Add support for cancellation of a follow request
This commit is contained in:
parent
c27d1d65bf
commit
8c71f7e11a
5 changed files with 75 additions and 10 deletions
|
|
@ -536,6 +536,30 @@ defmodule Pleroma.Web.CommonAPITest do
|
|||
|
||||
refute User.subscribed_to?(follower, followed)
|
||||
end
|
||||
|
||||
test "cancels a pending follow" do
|
||||
follower = insert(:user)
|
||||
followed = insert(:user, locked: true)
|
||||
|
||||
assert {:ok, follower, followed, %{id: activity_id, data: %{"state" => "pending"}}} =
|
||||
CommonAPI.follow(follower, followed)
|
||||
|
||||
assert %{state: "pending"} = Pleroma.FollowingRelationship.get(follower, followed)
|
||||
|
||||
assert {:ok, follower} = CommonAPI.unfollow(follower, followed)
|
||||
|
||||
assert Pleroma.FollowingRelationship.get(follower, followed) == nil
|
||||
|
||||
assert %{id: ^activity_id, data: %{"state" => "cancelled"}} =
|
||||
Pleroma.Web.ActivityPub.Utils.fetch_latest_follow(follower, followed)
|
||||
|
||||
assert %{
|
||||
data: %{
|
||||
"type" => "Undo",
|
||||
"object" => %{"type" => "Follow", "state" => "cancelled"}
|
||||
}
|
||||
} = Pleroma.Web.ActivityPub.Utils.fetch_latest_undo(follower)
|
||||
end
|
||||
end
|
||||
|
||||
describe "accept_follow_request/2" do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue