Deleting comments does not remove "HasComments"-state -> How do I fix this?

Topics: Administration, Core, Installing Orchard, Troubleshooting, Writing modules
Jan 29, 2014 at 9:16 AM
As stated in this issue:

The problem is obviously in Orchard.Comments.Projections.CommentsFilter:
        public void ApplyFilter(dynamic context) {
            var query = (IHqlQuery)context.Query;
            context.Query = query.Where(x => x.ContentPartRecord<CommentsPartRecord>(), x => x.IsNotEmpty("CommentPartRecords"));
I know I have to modify the query, specifically the x => x.IsNotEmpty("CommentPartRecords")-part. But how can I change it so that it will only take into account published items?