From 49b566716779d194d8e6d42e4005219c62a96d11 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Wed, 3 Jul 2019 18:52:17 -0700 Subject: [PATCH] Fixing trending sorting. --- server/Cargo.toml | 2 ++ server/src/db/community_view.rs | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/server/Cargo.toml b/server/Cargo.toml index 58984502..6e14e81a 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -23,3 +23,5 @@ strum_macros = "0.14.0" jsonwebtoken = "*" regex = "*" lazy_static = "*" +reqwest = "*" +openssl = { version = "0.10", features = ["vendored"] } diff --git a/server/src/db/community_view.rs b/server/src/db/community_view.rs index ec77cc8f..d0dca738 100644 --- a/server/src/db/community_view.rs +++ b/server/src/db/community_view.rs @@ -125,7 +125,9 @@ impl CommunityView { // The view lets you pass a null user_id, if you're not logged in match sort { - SortType::Hot => query = query.order_by(hot_rank.desc()).filter(user_id.is_null()), + SortType::Hot => query = query.order_by(hot_rank.desc()) + .then_order_by(published.desc()) + .filter(user_id.is_null()), SortType::New => query = query.order_by(published.desc()).filter(user_id.is_null()), SortType::TopAll => { match from_user_id { -- 2.44.1