From 1e83cd019eaaba65c1d579df5ce55e373975f70a Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Tue, 18 Feb 2020 02:52:11 -0600 Subject: make sure fang/defang gets logged when set by an `update` --- app/models/user.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app/models') diff --git a/app/models/user.rb b/app/models/user.rb index 7f47ecc3f..88ee91801 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -536,6 +536,14 @@ class User < ApplicationRecord def set_last_fanged_at return unless defanged_changed? && !last_fanged_at_changed? self.last_fanged_at = (defanged? ? nil : Time.now.utc) + + return unless usernme&.account? + + if defanged? + LogWorker.perform_async("\u23ec <#{self.account.username}> is no longer in fanged #{role} mode.") + else + LogWorker.perform_async("\u23eb <#{self.account.username}> switched to fanged #{role} mode.") + end end def open_registrations? -- cgit