FIX: Ignore posts needing approval when calculating reviewable counts. (PR #13464)

In #12841, we started setting the ReviewableQueuedPost's target and topic after approving it instead of storing them in the payload. As a result, the reviewable_counts query started to include queued posts.

When a category is set to require approval, every post has an associated reviewable. Pointing that each post has an associated queued post is not necessary in this case, so I added a WHERE clause to skip them.


  describe '#reviewable_counts' do

I think we should test for the actual values here in the hash. Otherwise, the assertion here is too generic. Any object that responds to empty? can potentially pass this test.

This pull request has been mentioned on Discourse Meta. There might be relevant details there: