From 0f3b01eaab82325baaf1c7a4c75a322d3c21a67f Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Tue, 18 Feb 2020 02:02:54 -0600 Subject: 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 --- app/workers/scheduler/defang_scheduler.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 app/workers/scheduler/defang_scheduler.rb (limited to 'app/workers/scheduler') 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 -- cgit