flags/appeals: replace is_resolved flag with statuses.

Replace references to the `is_resolved` field with the `status` field.
Post flags were marked as resolved when a post was approved (but not
when the post was deleted because it went unapproved). The status field
supercedes the resolved field.
This commit is contained in:
evazion
2020-08-07 18:53:25 -05:00
parent 2b0cd3c90b
commit 3a17b5a13e
14 changed files with 33 additions and 54 deletions

View File

@@ -3,6 +3,6 @@
<%= f.input :post_tags_match, label: "Tags", input_html: { value: params[:search][:post_tags_match], data: { autocomplete: "tag-query" } } %>
<%= f.input :post_id, label: "Post ID", input_html: { value: params[:search][:post_id] } %>
<%= f.input :creator_name, label: "Creator", input_html: { value: params[:search][:creator_name], data: { autocomplete: "user" } } %>
<%= f.input :is_resolved, label: "Resolved?", collection: [["Yes", true], ["No", false]], include_blank: true, selected: params[:search][:is_resolved] %>
<%= f.input :status, collection: PostAppeal.statuses, include_blank: true, selected: params[:search][:status] %>
<%= f.submit "Search" %>
<% end %>

View File

@@ -16,8 +16,8 @@
<% t.column "Appeals", width: "1%" do |post_appeal| %>
<%= link_to post_appeal.post.appeals.size, post_appeals_path(search: { post_id: post_appeal.post_id }) %>
<% end %>
<% t.column "Resolved?", width: "5%" do |post_appeal| %>
<%= link_to post_appeal.is_resolved.to_s, post_appeals_path(search: params[:search].merge(is_resolved: post_appeal.is_resolved)) %>
<% t.column "Status", width: "5%" do |post_appeal| %>
<%= link_to post_appeal.status, post_appeals_path(search: { status: post_appeal.status }) %>
<% end %>
<% t.column "Uploaded", width: "15%" do |post_appeal| %>
<%= compact_time post_appeal.post.created_at %>

View File

@@ -4,6 +4,14 @@
<%= table_for @events, class: "striped autofit", width: "100%" do |t| %>
<% t.column :type_name, name: "Type" %>
<% t.column "Description", td: { class: "col-expand" } do |event| %>
<div class="prose">
<%= format_text event.reason %>
</div>
<% end %>
<% t.column "Status" do |event| %>
<%= event.status %>
<% end %>
<% t.column "User" do |event| %>
<% if event.is_creator_visible? %>
<%= link_to_user event.creator %>
@@ -12,12 +20,6 @@
<% end %>
<br><%= time_ago_in_words_tagged event.created_at %>
<% end %>
<% t.column "Description", td: { class: "col-expand" } do |event| %>
<div class="prose">
<%= format_text event.reason %>
</div>
<% end %>
<% t.column :is_resolved, name: "Resolved" %>
<% end %>
</div>
</div>

View File

@@ -8,10 +8,6 @@
<% end %>
- <%= time_ago_in_words_tagged(flag.created_at) %>
<% if flag.is_resolved? %>
<span class="resolved">RESOLVED</span>
<% end %>
</li>
<% end %>
</ul>

View File

@@ -5,7 +5,7 @@
<% if policy(PostFlag).can_search_flagger? %>
<%= f.input :creator_name, label: "Creator", input_html: { value: params[:search][:creator_name], data: { autocomplete: "user" } } %>
<% end %>
<%= f.input :is_resolved, label: "Resolved?", collection: [["Yes", true], ["No", false]], include_blank: true, selected: params[:search][:is_resolved] %>
<%= f.input :category, label: "Category", collection: ["normal", "unapproved", "rejected", "deleted"], include_blank: true, selected: params[:search][:category] %>
<%= f.input :status, collection: PostFlag.statuses, include_blank: true, selected: params[:search][:status] %>
<%= f.submit "Search" %>
<% end %>

View File

@@ -19,8 +19,8 @@
<% t.column "Category", width: "1%" do |post_flag| %>
<%= link_to post_flag.category.to_s, post_flags_path(search: params[:search].merge(category: post_flag.category)) %>
<% end %>
<% t.column "Resolved?", width: "1%" do |post_flag| %>
<%= link_to post_flag.is_resolved?.to_s, post_flags_path(search: params[:search].merge(is_resolved: post_flag.is_resolved?)) %>
<% t.column "Status", width: "5%" do |post_flag| %>
<%= link_to post_flag.status, post_flags_path(search: { status: post_flag.status }) %>
<% end %>
<% t.column "Uploaded", width: "15%" do |post_flag| %>
<%= compact_time post_flag.post.created_at %>