Thank you!
I’ve manually promoted some users who were previously well-known to the existing community members, so a bulk recalculation wouldn’t do what I want. (I had found that page while searching.)
That last was actually working, as it did for you. My problem was that I was looking at the /g groups overview page and refreshing it and looking for the trust_level_1 group count to decrease. It was not displaying a change in count while I was running it, so I stopped it with control-C. This morning the trust_level_1 group now has thousands of fewer members displaying on that page. So now I realize that the count there is cached, and I should have been clicking on that card and looking at the count on the /g/trust_level_1 page.
Now I understand that I should have followed up with Group.ensure_consistency! to repair the counts on that page.
Here’s the whole thing, expressed more compactly and idiomatically:
User.where(trust_level: 1).each do |u|
u.change_trust_level!(TrustLevel[0]) if u.primary_email&.email.end_with?(".invalid")
end
Group.ensure_consistency!
It happens that I have a record of a few users with only an invalid email with a record of having actually used the site and met TL1 requirements. I don’t know how that happened, but for now I don’t care. All I really care about is taking care of the bulk of thousands, without worrying about the few exceptions. If this happens to anyone else, this worked for me:
User.where(trust_level: 1).each do |u|
begin
u.change_trust_level!(TrustLevel[0]) if u.primary_email&.email.end_with?(".invalid")
rescue
end
end
Group.ensure_consistency!