Fix #3754: Include unbans in Mod Actions.

This commit is contained in:
evazion
2018-08-22 00:08:33 -05:00
parent 0fcdc30b69
commit 8cc393183e
2 changed files with 9 additions and 3 deletions

View File

@@ -1,8 +1,9 @@
class Ban < ApplicationRecord
after_create :create_feedback
after_create :update_user_on_create
after_create :create_mod_action
after_create :create_ban_mod_action
after_destroy :update_user_on_destroy
after_destroy :create_unban_mod_action
belongs_to :user
belongs_to :banner, :class_name => "User"
validate :user_is_inferior
@@ -120,7 +121,11 @@ class Ban < ApplicationRecord
user.feedback.create(category: "negative", body: "Banned for #{humanized_duration}: #{reason}")
end
def create_mod_action
ModAction.log(%{Banned <@#{user_name}> for #{humanized_duration}: #{reason}},:user_ban)
def create_ban_mod_action
ModAction.log(%{Banned <@#{user_name}> for #{humanized_duration}: #{reason}}, :user_ban)
end
def create_unban_mod_action
ModAction.log(%{Unbanned <@#{user_name}>}, :user_unban)
end
end

View File

@@ -17,6 +17,7 @@ class ModAction < ApplicationRecord
enum category: {
user_delete: 2,
user_ban: 4,
user_unban: 5,
user_name_change: 6,
user_level: 7,
user_approval_privilege: 8,