about summary refs log tree commit diff
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2020-02-18 02:52:11 -0600
committermultiple creatures <dev@multiple-creature.party>2020-02-18 02:52:11 -0600
commit1e83cd019eaaba65c1d579df5ce55e373975f70a (patch)
tree3f2deea15b05cd31c45bfa6c537b26a0864b7c03
parente4633a1150450396157640f5262393bb52db280b (diff)
make sure fang/defang gets logged when set by an `update`
-rw-r--r--app/models/user.rb8
1 files changed, 8 insertions, 0 deletions
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?