move `Scheduler::JanitorScheduler::admin_account` to `ModerationHelper::janitor_account`

staging
multiple creatures 2019-08-03 23:25:37 -05:00
parent 0a646efd48
commit 4801d5ac84
2 changed files with 7 additions and 8 deletions

View File

@ -4,6 +4,12 @@ module ModerationHelper
POLICIES = %w(silence unsilence suspend unsuspend force_unlisted allow_public force_sensitive allow_nonsensitive reset)
EXCLUDED_DOMAINS = %w(tailma.ws monsterpit.net monsterpit.cloud monsterpit.gallery monsterpit.blog)
def janitor_account
account_id = ENV.fetch('JANITOR_USER', '').to_i
return if account_id == 0
Account.find_by(id: account_id)
end
def account_policy(username, domain, policy, reason = nil)
return if policy.blank?
policy = policy.to_s

View File

@ -10,7 +10,7 @@ class Scheduler::JanitorScheduler
sidekiq_options unique: :until_executed, retry: 0
def perform
@account = admin_account
@account = janitor_account
return if @account.nil?
@exclude_ids = excluded_account_ids
@ -63,13 +63,6 @@ class Scheduler::JanitorScheduler
end
def admin_account
account_id = ENV.fetch('JANITOR_USER', '').to_i
return if account_id == 0
Account.find_by(id: account_id)
end
def spammer_accounts
spammer_ids = spammer_account_ids
Account.reorder(nil).where(id: spammer_ids, suspended_at: nil)