From c7512917696f5b534f3c541e02e4744d37c09134 Mon Sep 17 00:00:00 2001 From: Roman Rizzi Date: Mon, 30 Dec 2019 14:56:17 -0300 Subject: [PATCH] FIX: The 'reviewed' status filter should include deleted elements (#8630) --- app/models/reviewable.rb | 2 +- spec/models/reviewable_spec.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/models/reviewable.rb b/app/models/reviewable.rb index 287d5a5f924..8f6caaafa03 100644 --- a/app/models/reviewable.rb +++ b/app/models/reviewable.rb @@ -604,7 +604,7 @@ protected return partial_result if status == :all if status == :reviewed - partial_result.where(status: [statuses[:approved], statuses[:rejected], statuses[:ignored]]) + partial_result.where(status: statuses.except(:pending).values) else partial_result.where(status: statuses[status]) end diff --git a/spec/models/reviewable_spec.rb b/spec/models/reviewable_spec.rb index 84235644b17..615f6e581d8 100644 --- a/spec/models/reviewable_spec.rb +++ b/spec/models/reviewable_spec.rb @@ -460,4 +460,12 @@ RSpec.describe Reviewable, type: :model do expect(results.first).to eq first_reviewable end end + + describe '.by_status' do + it 'includes reviewables with deleted targets when passing the reviewed status' do + reviewable = Fabricate(:reviewable_queued_post, status: Reviewable.statuses[:deleted]) + + expect(Reviewable.by_status(Reviewable.all, :reviewed)).to contain_exactly(reviewable) + end + end end