# בקשה לעזרה בהורדת משתמשים עם כתובות אימייל לא תקינות

**URL:** <https://meta.discourse.org/t/requesting-help-demoting-users-with-invalid-email-addresses/228990>\
**Category:** Product Support\
**Created:** [4 ביוני,‏ 2022,‏ 3:11am UTC](https://meta.discourse.org/t/requesting-help-demoting-users-with-invalid-email-addresses/228990 "2022-06-04T03:11:50Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![mcdanlj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcdanlj/32/131829_2.png) [@mcdanlj](https://meta.discourse.org/u/mcdanlj)\
**Post date:** [4 ביוני,‏ 2022,‏ 11:49am UTC](https://meta.discourse.org/t/requesting-help-demoting-users-with-invalid-email-addresses/228990/5 "2022-06-04T11:49:58Z")

</div>

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:

```plaintext
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:

```plaintext
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!

```

---

_[View the full topic](https://meta.discourse.org/t/requesting-help-demoting-users-with-invalid-email-addresses/228990)._
