mirror of
https://github.com/redlib-org/redlib.git
synced 2025-06-07 15:17:47 +00:00
Default subreddit post sorting. Closes #166
This commit is contained in:
parent
2533e8cef5
commit
6a7f725c12
6 changed files with 16 additions and 20 deletions
|
@ -32,7 +32,8 @@ pub async fn community(req: Request<Body>) -> Result<Response<Body>, String> {
|
|||
// Build Reddit API path
|
||||
let subscribed = cookie(&req, "subscriptions");
|
||||
let front_page = cookie(&req, "front_page");
|
||||
let sort = req.param("sort").unwrap_or_else(|| req.param("id").unwrap_or("hot".to_string()));
|
||||
let post_sort = req.cookie("post_sort").map(|c| c.value().to_string()).unwrap_or("hot".to_string());
|
||||
let sort = req.param("sort").unwrap_or(req.param("id").unwrap_or(post_sort));
|
||||
|
||||
let sub = req.param("sub").map(String::from).unwrap_or(if front_page == "default" || front_page.is_empty() {
|
||||
if subscribed.is_empty() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue