Merge branch 'fix/self-follow' into 'develop'
Dont include the user in their own follower count. See merge request pleroma/pleroma!29
This commit is contained in:
commit
1625021a9c
|
@ -265,6 +265,7 @@ def update_note_count(%User{} = user) do
|
||||||
def update_follower_count(%User{} = user) do
|
def update_follower_count(%User{} = user) do
|
||||||
follower_count_query = from u in User,
|
follower_count_query = from u in User,
|
||||||
where: fragment("? @> ?", u.following, ^user.follower_address),
|
where: fragment("? @> ?", u.following, ^user.follower_address),
|
||||||
|
where: u.id != ^user.id,
|
||||||
select: count(u.id)
|
select: count(u.id)
|
||||||
|
|
||||||
follower_count = Repo.one(follower_count_query)
|
follower_count = Repo.one(follower_count_query)
|
||||||
|
|
|
@ -71,6 +71,7 @@ test "unfollow doesn't unfollow yourself" do
|
||||||
|
|
||||||
{:error, _} = User.unfollow(user, user)
|
{:error, _} = User.unfollow(user, user)
|
||||||
|
|
||||||
|
user = Repo.get(User, user.id)
|
||||||
assert user.following == [user.ap_id]
|
assert user.following == [user.ap_id]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue