diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-08-26 11:39:40 -0500 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-08-26 11:39:40 -0500 |
commit | 35636272c0164372954b52a8a957ba08d645330d (patch) | |
tree | fb1b15318990752739bc903e8e8037bb2768094c /app/models | |
parent | 89f49712acae3cd5b20b73975ee584ebcab2efcd (diff) |
detect spam registrations + include account approvals/rejections in transparancy log
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/user.rb | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index a0786aa69..11289a0a5 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -198,7 +198,7 @@ class User < ApplicationRecord if new_user && approved? prepare_new_user! elsif new_user - notify_staff_about_pending_account! + RegistrationJanitorWorker.perform_async(id) end end @@ -242,6 +242,14 @@ class User < ApplicationRecord save! end + def notify_staff_about_pending_account! + LogWorker.perform_async("\xf0\x9f\x86\x95 New account <#{Account.find(account_id).username}> is awaiting admin approval.\n\nReview (moderators only): https://#{Rails.configuration.x.web_domain || Rails.configuration.x.local_domain}/admin/pending_accounts") + User.staff.includes(:account).each do |u| + next unless u.allows_pending_account_emails? + AdminMailer.new_pending_account(u.account, self).deliver_later + end + end + def wants_larger_menus? @wants_larger_menus ||= (settings.larger_menus || false) end @@ -496,13 +504,6 @@ class User < ApplicationRecord regenerate_feed! if needs_feed_update? end - def notify_staff_about_pending_account! - User.staff.includes(:account).each do |u| - next unless u.allows_pending_account_emails? - AdminMailer.new_pending_account(u.account, self).deliver_later - end - end - def regenerate_feed! return unless Redis.current.setnx("account:#{account_id}:regeneration", true) Redis.current.expire("account:#{account_id}:regeneration", 1.day.seconds) |