I need deactivate users who has fake email.
I mentioned here:
cd /var/discourse
./launcher enter app
rails c
I write SQL query for that:
User.where("user_stats.post_count = 0 AND last_seen_at <= '2017-01-01' AND active = true").update_all(active: false)
Output:
[1] pry(main)> User.joins(:user_stat).where("user_stats.post_count = 0 AND last_[1] pry(main)> User.joins(:user_stat).where("user_stats.post_count = 0 AND last_=> 4591 <= '2017-01-01' AND active = true").update_all(active: false)
It seems worked. Please backup your Discourse before run that SQL.
Do you have any better suggestions?