FIX: We don't create a Post object if the queued post gets rejected. We need to count review items directly. (#9856)

This commit is contained in:
Roman Rizzi
2020-05-22 11:50:28 -03:00
committed by GitHub
parent f9649c92b5
commit 671f882fa3
2 changed files with 5 additions and 11 deletions

View File

@@ -1115,10 +1115,9 @@ class User < ActiveRecord::Base
end
def number_of_rejected_posts
Post.with_deleted
.where(user_id: self.id)
.joins('INNER JOIN reviewables r ON posts.id = r.target_id')
.where(r: { status: Reviewable.statuses[:rejected], type: ReviewableQueuedPost.name })
ReviewableQueuedPost
.where(status: Reviewable.statuses[:rejected])
.where(created_by_id: self.id)
.count
end