FIX: The 'reviewed' status filter should include deleted elements (#8630)

This commit is contained in:
Roman Rizzi 2019-12-30 14:56:17 -03:00 committed by GitHub
parent 5214f82841
commit c751291769
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -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

View File

@ -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