diff options
author | multiple creatures <dev@multiple-creature.party> | 2020-02-18 02:02:54 -0600 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2020-02-18 02:18:09 -0600 |
commit | 0f3b01eaab82325baaf1c7a4c75a322d3c21a67f (patch) | |
tree | f3d19c99328336997919803ffc6850a96d5a6411 /app/workers | |
parent | fc69e4a0bb4e3d2fdcb2ffef0f3211f8c347ed15 (diff) |
switch to irc-like oper behavior; require mods & admins to explicitly oper up using `fangs`/`op` bangtag or toggling defang setting in profile; auto-defang after 15 mins or with `defang`/`deop` bangtag
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/scheduler/defang_scheduler.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/workers/scheduler/defang_scheduler.rb b/app/workers/scheduler/defang_scheduler.rb new file mode 100644 index 000000000..a20242a23 --- /dev/null +++ b/app/workers/scheduler/defang_scheduler.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class Scheduler::DefangScheduler + include Sidekiq::Worker + include ServiceAccountHelper + + def perform + User.where(defanged: false, last_fanged_at: nil).or(User.where('last_fanged_at >= ?', 15.minutes.ago)) do + |user| user.defang! + next unless user&.account.present? + service_dm('announcements', user.account, "You are no longer in #{user.role} mode.", footer: 'auto-defang') + end + end +end |