post events: show post-related mod actions on post event page.

Show the following actions on the post events page:

* Post bans and unbans
* Post deletions and undeletions
* Thumbnail regenerations and IQDB regenerations
* Favorites moves
* Rating locks and unlocks
* Note locks and unlocks

Fixes #3825: Events/Moderation page for each post should show eventual ban actions
This commit is contained in:
evazion
2022-09-26 03:24:50 -05:00
parent 75a2814f18
commit 67c992bfbf
8 changed files with 138 additions and 7 deletions

View File

@@ -14,4 +14,5 @@
<%= subnav_link_to "Disapprovals", post_disapprovals_path %>
<%= subnav_link_to "Flags", post_flags_path %>
<%= subnav_link_to "Replacements", post_replacements_path %>
<%= subnav_link_to "Mod Actions", mod_actions_path(search: { subject_type: "Post" }) %>
<% end %>

View File

@@ -11,7 +11,7 @@
<%= search_form_for(post_events_path) do |f| %>
<%= f.input :creator_name, label: "User", input_html: { value: params[:search][:creator_name], "data-autocomplete": "user" } %>
<%= f.input :post_tags_match, label: "Tags", input_html: { value: params[:search][:post_tags_match], "data-autocomplete": "tag-query" } %>
<%= f.input :model_type, label: "Category", collection: PostEvent.model_types.map { |type| [type.titleize.delete_prefix("Post "), type] }, include_blank: true, selected: params[:search][:model_type] %>
<%= f.input :category, label: "Category", collection: PostEvent.categories.map { |category| [category.titleize, category] }, include_blank: true, selected: params[:search][:category] %>
<%= f.input :order, collection: [%w[Newest event_at], %w[Oldest event_at_asc]], include_blank: true, selected: params[:search][:order] %>
<%= f.submit "Search" %>
<% end %>
@@ -60,11 +60,38 @@
(<%= external_link_to model.original_url.presence || "none", Source::URL.site_name(model.original_url) || model.original_url %> ->
<%= external_link_to model.replacement_url, Source::URL.site_name(model.replacement_url) || model.replacement_url %>).
<% end %>
<% when "ModAction" %>
<% case model.category %>
<% when "post_ban" %>
<%= link_to post.dtext_shortlink, post %> was banned by <%= link_to_user creator %>.
<% when "post_unban" %>
<%= link_to post.dtext_shortlink, post %> was unbanned by <%= link_to_user creator %>.
<% when "post_delete" %>
<%= link_to post.dtext_shortlink, post %> was deleted by <%= link_to_user creator %>.
<% when "post_undelete" %>
<%= link_to post.dtext_shortlink, post %> was undeleted by <%= link_to_user creator %>.
<% when "post_regenerate" %>
<%= link_to post.dtext_shortlink, post %> had its thumbnails regenerated by <%= link_to_user creator %>.
<% when "post_regenerate_iqdb" %>
<%= link_to post.dtext_shortlink, post %> was reindexed in IQDB by <%= link_to_user creator %>.
<% when "post_rating_lock_create" %>
<%= link_to post.dtext_shortlink, post %> was rating locked by <%= link_to_user creator %>.
<% when "post_rating_lock_delete" %>
<%= link_to post.dtext_shortlink, post %> was rating unlocked by <%= link_to_user creator %>.
<% when "post_note_lock_create" %>
<%= link_to post.dtext_shortlink, post %> was note locked by <%= link_to_user creator %>.
<% when "post_note_lock_delete" %>
<%= link_to post.dtext_shortlink, post %> was note unlocked by <%= link_to_user creator %>.
<% else %>
<div class="prose">
<%= link_to_user creator %> <%= format_text(model.description.chomp(".").strip, inline: true) %>.
</div>
<% end %>
<% end %>
<% end %>
<% t.column "Category" do |event| %>
<%= link_to event.model_type.titleize.delete_prefix("Post "), post_events_path(search: { model_type: event.model_type, **search_params }) %>
<%= link_to event.pretty_category, post_events_path(search: { category: event.category, **search_params }) %>
<% end %>
<% t.column "User" do |event| %>