From ada5f8be5d016d77636d0835c9938478565a8dea Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 17 Oct 2023 18:00:30 +0200 Subject: [PATCH] move line --- crates/db_views/src/comment_view.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/db_views/src/comment_view.rs b/crates/db_views/src/comment_view.rs index 86dcc88f7..97ddf51c0 100644 --- a/crates/db_views/src/comment_view.rs +++ b/crates/db_views/src/comment_view.rs @@ -220,11 +220,6 @@ fn queries<'a>() -> Queries< query = query.filter(person_block::person_id.is_null()); } - // distinguished comments should go first when viewing post - if options.post_id.is_some() || options.parent_path.is_some() { - query = query.order_by(comment::distinguished.desc()); - } - // A Max depth given means its a tree fetch let (limit, offset) = if let Some(max_depth) = options.max_depth { let depth_limit = if let Some(parent_path) = options.parent_path.as_ref() { @@ -258,6 +253,11 @@ fn queries<'a>() -> Queries< limit_and_offset(options.page, options.limit)? }; + // distinguished comments should go first when viewing post + if options.post_id.is_some() || options.parent_path.is_some() { + query = query.order_by(comment::distinguished.desc()); + } + query = match options.sort.unwrap_or(CommentSortType::Hot) { CommentSortType::Hot => query .then_order_by(comment_aggregates::hot_rank.desc())