Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

AO3-5234: Fix for unapproving approved works #3177

Merged
merged 4 commits into from Nov 21, 2017
@@ -38,13 +38,10 @@ def self.processed_bulk_ids(params = {})
def self.bulk_review(ids)
return true unless ids.present?
- where(id: ids).update_all("reviewed = 1")
- admin_settings = Rails.cache.fetch("admin_settings"){ AdminSetting.first }
- # If spam isn't hidden by default, hide it now
- unless admin_settings.hide_spam?
- Work.joins(:moderated_work).where("moderated_works.id IN (?)", ids).each do |work|
- work.update_attribute(:hidden_by_admin, true)
- end
+ where(id: ids).update_all(reviewed: true, approved: false)
+ # Ensure works are hidden and spam if they weren't already
+ Work.joins(:moderated_work).where("moderated_works.id IN (?)", ids).each do |work|
+ work.update_attributes(hidden_by_admin: true, spam: true)
end
end
@@ -1,11 +1,14 @@
<!--Descriptive page name, messages and instructions-->
-<h2 class="heading"><%= ts("Works Marked as Spam") %></h2>
+<h2 class="heading"><%= ts("Manage Potential Spam") %></h2>
<!--/descriptions-->
<!--subnav-->
<ul class="navigation actions" role="navigation">
<li>
- <%= span_if_current ts("Reviewed Works"), { show: "reviewed" } %>
+ <%= span_if_current ts("Unreviewed Works"), admin_spam_index_path, params[:show].blank? %>
+ </li>
+ <li>
+ <%= span_if_current ts("Confirmed Spam"), { show: "reviewed" } %>
</li>
<li>
<%= span_if_current ts("Approved Works"), { show: "approved" } %>
@@ -23,7 +26,7 @@
<th scope="col"><%= ts("Creator") %></th>
<th scope="col"><%= ts("Revised At") %></th>
<th scope="col">
- <%= ts("Mark Reviewed") %>
+ <%= ts("Confirm As Spam") %>
<ul class="actions">
<li>
<button id="spam_all_select" type="button">