with %User{local: true} = blocked <- User.get_cached_by_ap_id(blocked),
%User{} = blocker <- User.get_or_fetch_by_ap_id(blocker),
{:ok, activity} <- ActivityPub.unblock(blocker, blocked, id, false) do
+ User.unblock(blocker, blocked)
{:ok, activity}
else
e -> :error
"type": "Block",
"object": "http://localtesting.pleroma.lol/users/lain",
"nickname": "lain",
- "id": "http://mastodon.example.org/users/admin#follows/2",
+ "id": "http://mastodon.example.org/users/admin#blocks/2",
"actor": "http://mastodon.example.org/users/admin"
},
- "actor": "http://mastodon.example.org/users/admin"
+ "actor": "http://mastodon.example.org/users/admin",
+ "id": "http://mastodon.example.org/users/admin#blocks/2/undo"
}
"http://mastodon.example.org/users/admin/statuses/99542391527669785/activity"
end
- test "it works for incomming unfollows" do
+ test "it works for incomming unfollows with an existing follow" do
user = insert(:user)
follow_data =
assert User.blocks?(blocker, user)
end
- test "it works for incoming unblocks" do
+ test "it works for incoming unblocks with an existing block" do
user = insert(:user)
block_data =
assert data["type"] == "Undo"
assert data["object"]["type"] == "Block"
assert data["object"]["object"] == user.ap_id
- assert data["actor"] == "https://mastodon.example.org/users/admin"
+ assert data["actor"] == "http://mastodon.example.org/users/admin"
blocker = User.get_by_ap_id(data["actor"])
- refute User.blocks?(blocker, user.ap_id)
+ refute User.blocks?(blocker, user)
end
end