From: Dessalines Date: Thu, 8 Oct 2020 23:33:54 +0000 (-0500) Subject: Fixing a bug with stickied order. X-Git-Url: http://these/git/%7B%60https:/%7B%60css/themes/%22https:/nerdica.net/%7BdocsUrl%7D?a=commitdiff_plain;h=0b4ecdfc05df85d965fa29c9ac7e792dd1a59d04;p=lemmy.git Fixing a bug with stickied order. --- diff --git a/lemmy_db/src/post_view.rs b/lemmy_db/src/post_view.rs index 91c1bff5..ed7e4f3f 100644 --- a/lemmy_db/src/post_view.rs +++ b/lemmy_db/src/post_view.rs @@ -272,11 +272,15 @@ impl<'a> PostQueryBuilder<'a> { }; if let Some(for_community_id) = self.for_community_id { - query = query.filter(community_id.eq(for_community_id)); + query = query + .filter(community_id.eq(for_community_id)) + .then_order_by(stickied.desc()); } if let Some(for_community_name) = self.for_community_name { - query = query.filter(community_name.eq(for_community_name)); + query = query + .filter(community_name.eq(for_community_name)) + .then_order_by(stickied.desc()); } if let Some(url_search) = self.url_search { @@ -290,8 +294,6 @@ impl<'a> PostQueryBuilder<'a> { .or_filter(body.ilike(searcher)); } - query = query.then_order_by(stickied.desc()); - query = match self.sort { SortType::Active => query .then_order_by(hot_rank_active.desc())