mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: We need to skip users with associated reviewables when auto-approving (#9080)
* FIX: We need to skip users with associated reviewables when auto-approving them * Update spec/initializers/track_setting_changes_spec.rb * Update spec/initializers/track_setting_changes_spec.rb Co-authored-by: Robin Ward <robin.ward@gmail.com>
This commit is contained in:
@@ -4,7 +4,10 @@ DiscourseEvent.on(:site_setting_changed) do |name, old_value, new_value|
|
||||
# Enabling `must_approve_users` on an existing site is odd, so we assume that the
|
||||
# existing users are approved.
|
||||
if name == :must_approve_users && new_value == true
|
||||
User.where(approved: false).update_all(approved: true)
|
||||
|
||||
User.where(approved: false)
|
||||
.joins("LEFT JOIN reviewables r ON r.target_id = users.id")
|
||||
.where(r: { id: nil }).update_all(approved: true)
|
||||
end
|
||||
|
||||
if name == :emoji_set
|
||||
|
||||
Reference in New Issue
Block a user