Merge branch 'speedup-follow-requests' into 'develop'
Speedup follow requests Closes #677 See merge request pleroma/pleroma!871
This commit is contained in:
commit
089e2588a3
|
@ -613,9 +613,10 @@ def get_follow_requests_query(%User{} = user) do
|
||||||
),
|
),
|
||||||
where:
|
where:
|
||||||
fragment(
|
fragment(
|
||||||
"? @> ?",
|
"coalesce((?)->'object'->>'id', (?)->>'object') = ?",
|
||||||
a.data,
|
a.data,
|
||||||
^%{"object" => user.ap_id}
|
a.data,
|
||||||
|
^user.ap_id
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
@ -50,6 +50,20 @@ test "ap_followers returns the followers collection for the user" do
|
||||||
assert expected_followers_collection == User.ap_followers(user)
|
assert expected_followers_collection == User.ap_followers(user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "returns all pending follow requests" do
|
||||||
|
unlocked = insert(:user)
|
||||||
|
locked = insert(:user, %{info: %{locked: true}})
|
||||||
|
follower = insert(:user)
|
||||||
|
|
||||||
|
Pleroma.Web.TwitterAPI.TwitterAPI.follow(follower, %{"user_id" => unlocked.id})
|
||||||
|
Pleroma.Web.TwitterAPI.TwitterAPI.follow(follower, %{"user_id" => locked.id})
|
||||||
|
|
||||||
|
assert {:ok, []} = User.get_follow_requests(unlocked)
|
||||||
|
assert {:ok, [activity]} = User.get_follow_requests(locked)
|
||||||
|
|
||||||
|
assert activity
|
||||||
|
end
|
||||||
|
|
||||||
test "follow_all follows mutliple users" do
|
test "follow_all follows mutliple users" do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
followed_zero = insert(:user)
|
followed_zero = insert(:user)
|
||||||
|
|
Loading…
Reference in a new issue