prevent ordering by comment path without post filter (#3717)
This commit is contained in:
parent
13a866aeb0
commit
3b09d8c882
1 changed files with 5 additions and 2 deletions
|
@ -340,8 +340,11 @@ impl<'a> CommentQuery<'a> {
|
||||||
|
|
||||||
query = query.filter(nlevel(comment::path).le(depth_limit));
|
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 self.post_id.is_some() {
|
||||||
// Always order by the parent path first
|
// Always order by the parent path first
|
||||||
query = query.order_by(subpath(comment::path, 0, -1));
|
query = query.order_by(subpath(comment::path, 0, -1));
|
||||||
|
}
|
||||||
|
|
||||||
// TODO limit question. Limiting does not work for comment threads ATM, only max_depth
|
// TODO limit question. Limiting does not work for comment threads ATM, only max_depth
|
||||||
// For now, don't do any limiting for tree fetches
|
// For now, don't do any limiting for tree fetches
|
||||||
|
|
Loading…
Reference in a new issue