forked from AkkomaGang/akkoma
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
2 changed files with 2 additions and 0 deletions
|
@ -265,6 +265,7 @@ def update_note_count(%User{} = user) do
|
|||
def update_follower_count(%User{} = user) do
|
||||
follower_count_query = from u in User,
|
||||
where: fragment("? @> ?", u.following, ^user.follower_address),
|
||||
where: u.id != ^user.id,
|
||||
select: count(u.id)
|
||||
|
||||
follower_count = Repo.one(follower_count_query)
|
||||
|
|
|
@ -71,6 +71,7 @@ test "unfollow doesn't unfollow yourself" do
|
|||
|
||||
{:error, _} = User.unfollow(user, user)
|
||||
|
||||
user = Repo.get(User, user.id)
|
||||
assert user.following == [user.ap_id]
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue