mirror of
https://github.com/discourse/discourse.git
synced 2026-09-05 04:40:41 -05:00
FIX: Group can't be deleted if certain users are demoted.
This commit is contained in:
@@ -82,15 +82,8 @@ class GroupUser < ActiveRecord::Base
|
||||
.includes(:group)
|
||||
.maximum("groups.grant_trust_level")
|
||||
|
||||
if highest_level.nil?
|
||||
# If the user no longer has a group with a trust level,
|
||||
# unlock them, start at 0 and consider promotions.
|
||||
user.update!(group_locked_trust_level: nil)
|
||||
Promotion.recalculate(user)
|
||||
else
|
||||
user.update!(group_locked_trust_level: highest_level)
|
||||
user.change_trust_level!(highest_level)
|
||||
end
|
||||
user.update!(group_locked_trust_level: highest_level)
|
||||
Promotion.recalculate(user)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user