mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Migration should only update ReviewableUsers where the user is not approved. (#10790)
The reviewable was updated despite the user not being approved because a u.id = r.target_id condition is missing. It only affected user reviewables that were pending when the migration ran. Users were not auto-approved.
This commit is contained in:
parent
3de832248e
commit
7d5b18b7cf
@ -5,7 +5,8 @@ class ClearApprovedUsersFromTheReviewQueue < ActiveRecord::Migration[6.0]
|
||||
UPDATE reviewables r
|
||||
SET status = #{Reviewable.statuses[:approved]}
|
||||
FROM users u
|
||||
WHERE u.approved = true AND r.type = 'ReviewableUser' AND r.status = #{Reviewable.statuses[:pending]}
|
||||
WHERE u.id = r.target_id AND u.approved = true
|
||||
AND r.type = 'ReviewableUser' AND r.status = #{Reviewable.statuses[:pending]}
|
||||
RETURNING r.id
|
||||
SQL
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user