From e52e7f6e75f247fcf0e0d4369ca81edb7d93e5a5 Mon Sep 17 00:00:00 2001 From: Roman Rizzi Date: Tue, 7 Apr 2020 11:42:12 -0300 Subject: [PATCH] FIX: Include pending queued users regardless of their score (#9372) --- app/models/reviewable.rb | 5 ++++- spec/models/reviewable_spec.rb | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/models/reviewable.rb b/app/models/reviewable.rb index 78d4b98e650..771b37f4ee6 100644 --- a/app/models/reviewable.rb +++ b/app/models/reviewable.rb @@ -476,7 +476,10 @@ class Reviewable < ActiveRecord::Base result = result.where("created_at <= ?", to_date) if to_date if min_score > 0 && status == :pending && type.nil? - result = result.where("score >= ? OR type = ?", min_score, ReviewableQueuedPost.name) + result = result.where( + "score >= ? OR type IN (?)", + min_score, [ReviewableQueuedPost.name, ReviewableUser.name] + ) elsif min_score > 0 result = result.where("score >= ?", min_score) end diff --git a/spec/models/reviewable_spec.rb b/spec/models/reviewable_spec.rb index 9b46eb7c529..5fd051fc0c5 100644 --- a/spec/models/reviewable_spec.rb +++ b/spec/models/reviewable_spec.rb @@ -181,10 +181,11 @@ RSpec.describe Reviewable, type: :model do SiteSetting.reviewable_default_visibility = :high Reviewable.set_priorities(high: 10) @queued_post = Fabricate(:reviewable_queued_post, score: 0, target: post) + @queued_user = Fabricate(:reviewable_user, score: 0) end it 'includes queued posts when searching for pending reviewables' do - expect(Reviewable.list_for(user)).to contain_exactly(@queued_post) + expect(Reviewable.list_for(user)).to contain_exactly(@queued_post, @queued_user) end it 'excludes pending queued posts when applying a different status filter' do