From 76c171298921cd6969ce4b6eec9b54bca49b1043 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Mon, 12 Sep 2016 16:20:08 -0700 Subject: [PATCH] account for nothing left to moderate --- app/controllers/moderator/post/queues_controller.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/moderator/post/queues_controller.rb b/app/controllers/moderator/post/queues_controller.rb index 94bfb9171..51ed8a670 100644 --- a/app/controllers/moderator/post/queues_controller.rb +++ b/app/controllers/moderator/post/queues_controller.rb @@ -22,8 +22,14 @@ module Moderator cookies.permanent[:moderated] = Time.now.to_i ::Post.without_timeout do - @posts = ::Post.order("posts.id asc").pending_or_flagged.available_for_moderation(false).reorder("random()").limit(5) + @posts = ::Post.order("posts.id asc").where("false").pending_or_flagged.available_for_moderation(false).reorder("random()").limit(5) @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)