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

**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:** 1

<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,‏ 3:11am UTC](https://meta.discourse.org/t/requesting-help-demoting-users-with-invalid-email-addresses/228990/1 "2022-06-04T03:11:50Z")

</div>

For historical reasons, my Google+ importer imported users at TL1 to give google+ refugees a head start. They are [imported with `.invalid` email addresses,](https://meta.discourse.org/t/bounty-google-private-communities-export-screenscraper-importer/108029/14) and we fix that when they log in and get hooked up to their existing user record by their google ID through google auth.

But now my trust\_level\_1 group is bloated with thousands of users who haven’t followed their content yet, and if they show up after a few years (as they sometimes do continue to do) there’s no particular reason to come in as Basic users; they should be New users. Bootstrapping is long past. I’d like to demote those never-logged-in users to TL0 until such time as they show up and look around, and just depend on the normal promotion process.

I tried this in the rails console:

```
User.where(trust_level: 1) do |u|
    u.change_trust_level!(TrustLevel[0]) if !Email.is_valid?(u.primary_email&.email)
    u.save!
end

```

It took minutes of consuming a full CPU, but did nothing. (I tried other variations as well on the way there, like `if !u.primary_email.is_valid?` and `if !Email.is_valid?(u.primary_email)` and I know the real problem is that I touch Ruby once a year or so…) I’m sure I’m missing something obvious to others. I’d appreciate a hint if anyone can come up with one!

---

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