From 2c80d7b82edff3df60c890d064728ea9997e0d27 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Fri, 9 Sep 2016 15:08:23 -0700 Subject: [PATCH] more intelligent notice for mod queue --- app/assets/stylesheets/common/main_layout.css.scss | 2 +- app/controllers/application_controller.rb | 5 +++++ app/controllers/moderator/post/queues_controller.rb | 4 ++++ app/controllers/posts_controller.rb | 9 --------- app/views/layouts/default.html.erb | 4 ++++ app/views/moderator/post/queues/_notice.html.erb | 5 +++++ 6 files changed, 19 insertions(+), 10 deletions(-) create mode 100644 app/views/moderator/post/queues/_notice.html.erb diff --git a/app/assets/stylesheets/common/main_layout.css.scss b/app/assets/stylesheets/common/main_layout.css.scss index a8e50b4bb..2872d4d1c 100644 --- a/app/assets/stylesheets/common/main_layout.css.scss +++ b/app/assets/stylesheets/common/main_layout.css.scss @@ -9,7 +9,7 @@ div#page { margin: 0 20px; padding: 0 10px; - div#upgrade-account-notice, div#sign-up-notice, div#tos-notice, div#ban-notice, div#dmail-notice { + div#upgrade-account-notice, div#sign-up-notice, div#tos-notice, div#ban-notice, div#dmail-notice, div#mod-notice { margin: 1em 0; padding: 1em; text-align: center; diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 4d6a337e5..e241e4517 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -12,6 +12,7 @@ class ApplicationController < ActionController::Base # before_filter :secure_cookies_check layout "default" force_ssl :if => :ssl_login? + helper_method :show_moderation_notice? rescue_from Exception, :with => :rescue_exception rescue_from User::PrivilegeError, :with => :access_denied @@ -19,6 +20,10 @@ class ApplicationController < ActionController::Base rescue_from Danbooru::Paginator::PaginationError, :with => :render_pagination_limit protected + def show_moderation_notice? + CurrentUser.can_approve_posts? && (cookies[:moderated].blank? || Time.at(cookies[:moderated].to_i) < 1.day.ago) + end + def ssl_login? cookies[:ssl_login].present? end diff --git a/app/controllers/moderator/post/queues_controller.rb b/app/controllers/moderator/post/queues_controller.rb index 3c8248390..97273445a 100644 --- a/app/controllers/moderator/post/queues_controller.rb +++ b/app/controllers/moderator/post/queues_controller.rb @@ -31,6 +31,10 @@ module Moderator protected + def show_moderation_notice? + false + end + def per_page cookies["mq_per_page"] || params[:per_page] || 25 end diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 9c97b6113..fc948d893 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -27,8 +27,6 @@ class PostsController < ApplicationController end def show - notify_inactive_janitors - @post = Post.find(params[:id]) @post_flag = PostFlag.new(:post_id => @post.id) @post_appeal = PostAppeal.new(:post_id => @post.id) @@ -114,13 +112,6 @@ class PostsController < ApplicationController end private - def notify_inactive_janitors - if CurrentUser.can_approve_posts? && flash[:notice].blank? && (cookies[:moderated].blank? || Time.at(cookies[:moderated].to_i) < 1.day.ago) - flash[:notice] = "You haven't moderated any posts recently. Consider checking the queue." - #redirect_to(random_moderator_post_queue_path(:return_to => request.original_url)) - #return - end - end def tag_query params[:tags] || (params[:post] && params[:post][:tags]) diff --git a/app/views/layouts/default.html.erb b/app/views/layouts/default.html.erb index 0260c0010..fc3ea685a 100644 --- a/app/views/layouts/default.html.erb +++ b/app/views/layouts/default.html.erb @@ -89,6 +89,10 @@ <%= render "users/dmail_notice" %> <% end %> + <% if CurrentUser.user.can_approve_posts? %> + <%= render "moderator/post/queues/notice" %> + <% end %> + <% if cookies["accepted_tos"].blank? && !CurrentUser.is_gold? %> <%= render "users/tos" %> <% end %> diff --git a/app/views/moderator/post/queues/_notice.html.erb b/app/views/moderator/post/queues/_notice.html.erb new file mode 100644 index 000000000..63e4414e8 --- /dev/null +++ b/app/views/moderator/post/queues/_notice.html.erb @@ -0,0 +1,5 @@ +<% if show_moderation_notice? %> +
+ 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) %>. +
+<% end %>