approvers: remove "you haven't moderated in awhile" notice.

Remove the nag message when an approver hasn't approved anything
recently. Also remove the modqueue random posts page. As of 3d410398a,
inactive approvers are now warned via dmails.
This commit is contained in:
evazion
2020-02-26 23:42:47 -06:00
parent 41103cb6b5
commit cded0f763b
12 changed files with 1 additions and 95 deletions

View File

@@ -1,15 +1,11 @@
module Moderator module Moderator
module Post module Post
class QueuesController < ApplicationController class QueuesController < ApplicationController
RANDOM_COUNT = 12
respond_to :html, :json respond_to :html, :json
before_action :approver_only before_action :approver_only
skip_before_action :api_check skip_before_action :api_check
def show def show
cookies.permanent[:moderated] = Time.now.to_i
if search_params[:per_page] if search_params[:per_page]
cookies.permanent["mq_per_page"] = search_params[:per_page] cookies.permanent["mq_per_page"] = search_params[:per_page]
end end
@@ -21,23 +17,6 @@ module Moderator
respond_with(@posts) respond_with(@posts)
end end
def random
cookies.permanent[:moderated] = Time.now.to_i
::Post.without_timeout do
@posts = ::Post.includes(:disapprovals, :uploader).order("posts.id asc").pending_or_flagged.available_for_moderation(false).reorder("random()").limit(RANDOM_COUNT)
@posts.each # hack to force rails to eager load
if @posts.empty?
flash[:notice] = "Nothing left to moderate!"
redirect_to(params[:return_to] || posts_path)
return
end
end
respond_with(@posts)
end
protected protected
def per_page def per_page

View File

@@ -3,7 +3,6 @@ class PostApprovalsController < ApplicationController
respond_to :html, :xml, :json, :js respond_to :html, :xml, :json, :js
def create def create
cookies.permanent[:moderated] = Time.now.to_i
post = Post.find(params[:post_id]) post = Post.find(params[:post_id])
@approval = post.approve! @approval = post.approve!
respond_with(@approval) respond_with(@approval)

View File

@@ -4,7 +4,6 @@ class PostDisapprovalsController < ApplicationController
respond_to :js, :html, :json, :xml respond_to :js, :html, :json, :xml
def create def create
cookies.permanent[:moderated] = Time.now.to_i
@post_disapproval = PostDisapproval.create(user: CurrentUser.user, **post_disapproval_params) @post_disapproval = PostDisapproval.create(user: CurrentUser.user, **post_disapproval_params)
respond_with(@post_disapproval) respond_with(@post_disapproval)
end end

View File

@@ -333,10 +333,6 @@ module ApplicationHelper
content_for(:html_header, auto_discovery_link_tag(:atom, url, title: title)) content_for(:html_header, auto_discovery_link_tag(:atom, url, title: title))
end end
def show_moderation_notice?
CurrentUser.can_approve_posts? && (cookies[:moderated].blank? || Time.at(cookies[:moderated].to_i) < 72.hours.ago)
end
protected protected
def nav_link_match(controller, url) def nav_link_match(controller, url)

View File

@@ -2,18 +2,6 @@ import Utility from './utility'
let ModQueue = {}; let ModQueue = {};
ModQueue.processed = 0;
ModQueue.increment_processed = function() {
if (Utility.meta("random-mode") === "1") {
ModQueue.processed += 1;
if (ModQueue.processed === 12) {
window.location = Utility.meta("return-to");
}
}
}
ModQueue.detailed_rejection_dialog = function() { ModQueue.detailed_rejection_dialog = function() {
$("#post_disapproval_post_id").val($(this).data("post-id")); $("#post_disapproval_post_id").val($(this).data("post-id"));
$("#detailed-rejection-dialog").find("form")[0].reset(); $("#detailed-rejection-dialog").find("form")[0].reset();
@@ -23,7 +11,6 @@ ModQueue.detailed_rejection_dialog = function() {
} }
$(function() { $(function() {
$(window).on("danbooru:modqueue_increment_processed", ModQueue.increment_processed);
$(document).on("click.danbooru", ".quick-mod .detailed-rejection-link", ModQueue.detailed_rejection_dialog); $(document).on("click.danbooru", ".quick-mod .detailed-rejection-link", ModQueue.detailed_rejection_dialog);
}); });

View File

@@ -122,10 +122,6 @@
<%= render "users/dmail_notice" %> <%= render "users/dmail_notice" %>
<% end %> <% end %>
<% if CurrentUser.user.can_approve_posts? %>
<%= render "moderator/post/queues/notice" %>
<% end %>
<div class="notice notice-info" id="notice" style="<%= "display: none;" unless flash[:notice] %>"> <div class="notice notice-info" id="notice" style="<%= "display: none;" unless flash[:notice] %>">
<span class="prose"><%= format_text(flash[:notice], inline: true) %>.</span> <span class="prose"><%= format_text(flash[:notice], inline: true) %>.</span>
<a href="#" id="close-notice-link">close</a> <a href="#" id="close-notice-link">close</a>

View File

@@ -1,5 +0,0 @@
<% if show_moderation_notice? %>
<div class="notice notice-info notice-large" id="mod-notice">
<span>You haven't moderated any posts in awhile. Consider checking out the <%= link_to "queue", random_moderator_post_queue_path(:return_to => request.original_url) %>.</span>
</div>
<% end %>

View File

@@ -1,32 +0,0 @@
<% page_title "Mod Queue" %>
<div id="c-moderator-post-queues">
<div id="a-random">
<div>
<h1>Moderation Queue</h1>
<div id="moderation-guideline">
<p>Here are twelve random posts that are up for moderation. See if any of them are worth approving. Once you finish processing all of them you will be taken to the previous URL (<%= params[:return_to] %>).</p>
<h1>Deletion Guidelines</h1>
<%= render "desc" %>
</div>
<%= render "posts/partials/common/inline_blacklist" %>
<% @posts.each do |post| %>
<%= render "post", post: post %>
<% end %>
</div>
</div>
</div>
<%= render "post_disapprovals/detailed_rejection_dialog" %>
<%= render "posts/partials/common/secondary_links" %>
<% content_for(:html_header) do %>
<meta name="random-mode" content="1">
<meta name="return-to" content="<%= params[:return_to] %>">
<% end %>

View File

@@ -5,7 +5,6 @@
location.reload(); location.reload();
} else if ($("#c-moderator-post-queues").length) { } else if ($("#c-moderator-post-queues").length) {
$("#c-moderator-post-queues #post-<%= @approval.post.id %>").hide(); $("#c-moderator-post-queues #post-<%= @approval.post.id %>").hide();
$(window).trigger("danbooru:modqueue_increment_processed");
Danbooru.notice("Post was approved"); Danbooru.notice("Post was approved");
} }
<% end %> <% end %>

View File

@@ -5,7 +5,6 @@
location.reload(); location.reload();
} else if ($("#c-moderator-post-queues").length) { } else if ($("#c-moderator-post-queues").length) {
$("#c-moderator-post-queues #post-<%= @post_disapproval.post.id %>").hide(); $("#c-moderator-post-queues #post-<%= @post_disapproval.post.id %>").hide();
$(window).trigger("danbooru:modqueue_increment_processed");
Danbooru.notice("Post was hidden"); Danbooru.notice("Post was hidden");
} }
<% end %> <% end %>

View File

@@ -11,11 +11,7 @@ Rails.application.routes.draw do
end end
end end
namespace :post do namespace :post do
resource :queue, :only => [:show] do resource :queue, only: [:show]
member do
get :random
end
end
resources :posts, :only => [:delete, :expunge, :confirm_delete] do resources :posts, :only => [:delete, :expunge, :confirm_delete] do
member do member do
get :confirm_delete get :confirm_delete

View File

@@ -18,13 +18,6 @@ module Moderator
assert_response :success assert_response :success
end end
end end
context "random action" do
should "render" do
get_auth moderator_post_queue_path, @admin
assert_response :success
end
end
end end
end end
end end