diff --git a/app/controllers/ip_bans_controller.rb b/app/controllers/ip_bans_controller.rb index 823df0fc4..32b07dc5c 100644 --- a/app/controllers/ip_bans_controller.rb +++ b/app/controllers/ip_bans_controller.rb @@ -21,6 +21,14 @@ class IpBansController < ApplicationController respond_with(@ip_bans) end + def show + @ip_ban = authorize IpBan.find(params[:id]) + + respond_with(@ip_ban) do |format| + format.html { redirect_to ip_bans_path(search: { id: @ip_ban.id }) } + end + end + def update @ip_ban = authorize IpBan.find(params[:id]) @ip_ban.update(permitted_attributes(@ip_ban)) diff --git a/app/controllers/mod_actions_controller.rb b/app/controllers/mod_actions_controller.rb index ca75db6a6..6eb847a1e 100644 --- a/app/controllers/mod_actions_controller.rb +++ b/app/controllers/mod_actions_controller.rb @@ -5,7 +5,11 @@ class ModActionsController < ApplicationController def index @mod_actions = ModAction.visible(CurrentUser.user).paginated_search(params) - @mod_actions = @mod_actions.includes(:creator) if request.format.html? + + if request.format.html? + @mod_actions = @mod_actions.includes(:creator, :subject) + @dtext_data = DText.preprocess(@mod_actions.map(&:description)) + end respond_with(@mod_actions) end diff --git a/app/models/mod_action.rb b/app/models/mod_action.rb index 4d1c7acca..ba2b3066f 100644 --- a/app/models/mod_action.rb +++ b/app/models/mod_action.rb @@ -67,12 +67,10 @@ class ModAction < ApplicationRecord ip_ban_delete: 162, ip_ban_undelete: 163, mass_update: 1000, # XXX unused - bulk_revert: 1001, # XXX unused - other: 2000, } def self.model_types - %w[Artist Comment CommentVote ForumPost ForumTopic IpBan ModerationReport Pool Post PostVote Tag TagAlias TagImplication User UserFeedback] + %w[Artist Comment CommentVote ForumPost ForumTopic IpBan ModerationReport Pool Post PostVote Tag TagAlias TagImplication User] end def self.visible(user) diff --git a/app/views/mod_actions/_search.html.erb b/app/views/mod_actions/_search.html.erb index f9000b1a7..33b74f997 100644 --- a/app/views/mod_actions/_search.html.erb +++ b/app/views/mod_actions/_search.html.erb @@ -1,7 +1,11 @@ <%= search_form_for(mod_actions_path) do |f| %> <%= f.input :creator_name, label: "Creator", input_html: { value: params[:search][:creator_name], data: { autocomplete: "user" } } %> <%= f.input :description_matches, label: "Description", input_html: { value: params[:search][:description_matches] } %> - <%= f.input :category, label: "Category", collection: ModAction.categories.map {|k,v| [k.capitalize.tr("_"," "), v]}, include_blank: true,selected: params[:search][:category] %> + <% if params[:search][:subject_id].present? && params[:search][:subject_type] %> + <%= f.input :subject_id, label: "#{params[:search][:subject_type].titleize} ID", input_html: { value: params[:search][:subject_id] } %> + <% end %> + <%= f.input :subject_type, label: "Subject", collection: ModAction.model_types.map { |k, v| [k.titleize, k] }, include_blank: true, selected: params[:search][:subject_type] %> + <%= f.input :category, label: "Category", collection: ModAction.categories.map { |k, v| [k.capitalize.tr("_", " "), k] }, include_blank: true, selected: params[:search][:category] %> <%= f.input :order, collection: [%w[Newest created_at], %w[Oldest created_at_asc]], include_blank: true, selected: params[:search][:order] %> <%= f.submit "Search" %> <% end %> diff --git a/app/views/mod_actions/index.html.erb b/app/views/mod_actions/index.html.erb index 5bc064a9f..d6d8bb54c 100644 --- a/app/views/mod_actions/index.html.erb +++ b/app/views/mod_actions/index.html.erb @@ -5,14 +5,14 @@ <%= render "search" %> <%= table_for @mod_actions, class: "striped autofit" do |t| %> - <% t.column "Message", td: {class: "col-expand"} do |mod_action| %> + <% t.column "Description", td: { class: "col-expand" } do |mod_action| %>