]> Untitled Git - lemmy.git/blobdiff - crates/db_views/src/comment_view.rs
Fix ordering when doing a comment_parent type `list_comments` (#3823)
[lemmy.git] / crates / db_views / src / comment_view.rs
index 4cad1e74528238548ae34fe17c306b0e4021d461..45ab82bd7a51c2f5183463ec6cf7290e51ecb8a6 100644 (file)
@@ -237,8 +237,8 @@ fn queries<'a>() -> Queries<
 
       query = query.filter(nlevel(comment::path).le(depth_limit));
 
-      // only order if filtering by a post id. DOS potential otherwise and max_depth + !post_id isn't used anyways (afaik)
-      if options.post_id.is_some() {
+      // only order if filtering by a post id, or parent_path. DOS potential otherwise and max_depth + !post_id isn't used anyways (afaik)
+      if options.post_id.is_some() || options.parent_path.is_some() {
         // Always order by the parent path first
         query = query.order_by(subpath(comment::path, 0, -1));
       }