]> Untitled Git - lemmy.git/blobdiff - lemmy_db_views/src/post_view.rs
Adding stickied to post_aggregates.
[lemmy.git] / lemmy_db_views / src / post_view.rs
index 7b88cfcab93094e0b1bd6f84edf5a9f6ca91087d..2f82f8fe04fac9642ca8d8f63af3076aa46f19a4 100644 (file)
@@ -302,14 +302,14 @@ impl<'a> PostQueryBuilder<'a> {
     if let Some(community_id) = self.community_id {
       query = query
         .filter(post::community_id.eq(community_id))
-        .then_order_by(post::stickied.desc());
+        .then_order_by(post_aggregates::stickied.desc());
     }
 
     if let Some(community_name) = self.community_name {
       query = query
         .filter(community::name.eq(community_name))
         .filter(community::local.eq(true))
-        .then_order_by(post::stickied.desc());
+        .then_order_by(post_aggregates::stickied.desc());
     }
 
     if let Some(url_search) = self.url_search {
@@ -354,7 +354,7 @@ impl<'a> PostQueryBuilder<'a> {
       SortType::Hot => query
         .then_order_by(hot_rank(post_aggregates::score, post_aggregates::published).desc())
         .then_order_by(post_aggregates::published.desc()),
-      SortType::New => query.then_order_by(post::published.desc()),
+      SortType::New => query.then_order_by(post_aggregates::published.desc()),
       SortType::TopAll => query.then_order_by(post_aggregates::score.desc()),
       SortType::TopYear => query
         .filter(post::published.gt(now - 1.years()))
@@ -605,6 +605,7 @@ mod tests {
         score: 1,
         upvotes: 1,
         downvotes: 0,
+        stickied: false,
         published: agg.published,
         newest_comment_time: inserted_post.published,
       },