diff --git a/app/models/mod_action.rb b/app/models/mod_action.rb index d93cd3f2a..a1b6f04b9 100644 --- a/app/models/mod_action.rb +++ b/app/models/mod_action.rb @@ -73,6 +73,14 @@ class ModAction < ApplicationRecord q.apply_default_order(params) end + def filtered_description + if (ip_ban_create? || ip_ban_delete?) && !CurrentUser.user.is_moderator? + description.gsub(/(created|deleted) ip ban for .*/, "\\1 ip ban") + else + description + end + end + def category_id self.class.categories[category] end @@ -81,6 +89,10 @@ class ModAction < ApplicationRecord super + [:category_id] end + def serializable_hash(*args) + super(*args).merge("description" => filtered_description) + end + def self.log(desc, cat = :other) create(:description => desc,:category => categories[cat]) end diff --git a/app/views/mod_actions/index.html.erb b/app/views/mod_actions/index.html.erb index 6dc39dd1f..9b0b46b3c 100644 --- a/app/views/mod_actions/index.html.erb +++ b/app/views/mod_actions/index.html.erb @@ -17,7 +17,7 @@