From 7041fae5dddd93bfb8418585895979a7651b77bd Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 14 Oct 2021 15:31:06 -0400 Subject: [PATCH] Reordering filters to fix unread replies. --- crates/db_views/src/comment_view.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/db_views/src/comment_view.rs b/crates/db_views/src/comment_view.rs index 980483979..e61752805 100644 --- a/crates/db_views/src/comment_view.rs +++ b/crates/db_views/src/comment_view.rs @@ -209,18 +209,18 @@ impl CommentView { .and(community_block::person_id.eq(my_person_id)), ), ) - .filter(comment::read.eq(false)) - .filter(comment::deleted.eq(false)) - .filter(comment::removed.eq(false)) - // Don't show blocked communities or persons - .filter(community_block::person_id.is_null()) - .filter(person_block::person_id.is_null()) .filter(person_alias_1::id.eq(my_person_id)) // Gets the comment replies .or_filter( comment::parent_id .is_null() .and(post::creator_id.eq(my_person_id)), ) // Gets the top level replies + .filter(comment::read.eq(false)) + .filter(comment::deleted.eq(false)) + .filter(comment::removed.eq(false)) + // Don't show blocked communities or persons + .filter(community_block::person_id.is_null()) + .filter(person_block::person_id.is_null()) .select(count(comment::id)) .first::(conn) }