mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 11:23:25 +08:00
FIX: Fixed getting badges from inviting youself (#19778)
Update invite badge query to exclude self
This commit is contained in:
parent
48eb8d5f5a
commit
da0b401fa5
|
@ -160,11 +160,15 @@ module BadgeQueries
|
|||
FROM invites i
|
||||
JOIN invited_users iu ON iu.invite_id = i.id
|
||||
JOIN users u2 ON u2.id = iu.user_id
|
||||
WHERE i.deleted_at IS NULL AND u2.active AND u2.trust_level >= #{trust_level.to_i} AND u2.silenced_till IS NULL
|
||||
WHERE i.deleted_at IS NULL
|
||||
AND i.invited_by_id <> u2.id
|
||||
AND u2.active
|
||||
AND u2.trust_level >= #{trust_level.to_i}
|
||||
AND u2.silenced_till IS NULL
|
||||
GROUP BY invited_by_id
|
||||
HAVING COUNT(*) >= #{count.to_i}
|
||||
) AND u.active AND u.silenced_till IS NULL AND u.id > 0 AND
|
||||
(:backfill OR u.id IN (:user_ids) )
|
||||
(:backfill OR u.id IN (:user_ids) )
|
||||
SQL
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user