alias Pleroma.Web
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.ActivityPub.Utils
+ alias Pleroma.Web.CommonAPI
alias Pleroma.Web.CommonAPI.Utils, as: CommonUtils
alias Pleroma.Web.OAuth
alias Pleroma.Web.OStatus
blocker
end
+ # clear any requested follows as well
+ blocked =
+ case CommonAPI.reject_follow_request(blocked, blocker) do
+ {:ok, %User{} = updated_blocked} -> updated_blocked
+ nil -> blocked
+ end
+
blocker =
if subscribed_to?(blocked, blocker) do
{:ok, blocker} = unsubscribe(blocked, blocker)
assert activity
end
+ test "clears follow requests when requester is blocked" do
+ followed = insert(:user, %{info: %{locked: true}})
+ follower = insert(:user)
+
+ Pleroma.Web.TwitterAPI.TwitterAPI.follow(follower, %{"user_id" => followed.id})
+ assert {:ok, [_activity]} = User.get_follow_requests(followed)
+
+ {:ok, _follower} = User.block(followed, follower)
+ assert {:ok, []} = User.get_follow_requests(followed)
+ end
+
test "follow_all follows mutliple users" do
user = insert(:user)
followed_zero = insert(:user)