Do not include user in their own follower count.

This commit is contained in:
eal 2017-11-21 15:33:09 +02:00
parent 8d4e7b32c9
commit e9037ffc8d
1 changed files with 1 additions and 0 deletions

View File

@ -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)