Class: PotentialSpamProfilesJob
- Inherits:
-
ApplicationJob
- Object
- ActiveJob::Base
- ApplicationJob
- PotentialSpamProfilesJob
- Defined in:
- /var/apps/qpixel/app/jobs/potential_spam_profiles_job.rb
Instance Method Summary collapse
Methods inherited from ApplicationJob
Constructor Details
This class inherits a constructor from ApplicationJob
Instance Method Details
#perform ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File '/var/apps/qpixel/app/jobs/potential_spam_profiles_job.rb', line 4 def perform sql = File.read(Rails.root.join('db/scripts/potential_spam_profiles.sql')) sql = sql.gsub('$HOURS', '25') user_ids = ActiveRecord::Base.connection.execute(sql).to_a.flatten users = User.where(id: user_ids) ability_ids = Ability.unscoped.where(internal_id: 'unrestricted').map(&:id) users.each do |user| cu_ids = user.community_users.map(&:id) UserAbility.where(community_user_id: cu_ids, ability_id: ability_ids) .update_all(is_suspended: true, suspension_message: 'This ability has been automatically suspended.') end logger.info "Found #{users.size} likely spam profiles & suspended abilities." end |