mirror of
https://github.com/redlib-org/redlib.git
synced 2025-05-04 12:24:50 +00:00
Fixed Sorting
This commit is contained in:
parent
2c06ae1d8f
commit
05ea0fe1fd
10 changed files with 49 additions and 48 deletions
14
src/post.rs
14
src/post.rs
|
@ -6,7 +6,7 @@ use pulldown_cmark::{html, Options, Parser};
|
|||
|
||||
#[path = "utils.rs"]
|
||||
mod utils;
|
||||
use utils::{Comment, Flair, Post, val};
|
||||
use utils::{Params, Comment, Flair, Post, val};
|
||||
|
||||
// STRUCTS
|
||||
#[derive(Template)]
|
||||
|
@ -42,13 +42,11 @@ async fn short(web::Path(id): web::Path<String>) -> Result<HttpResponse> {
|
|||
}
|
||||
|
||||
#[get("/r/{sub}/comments/{id}/{title}/")]
|
||||
async fn page(web::Path((_sub, id)): web::Path<(String, String)>) -> Result<HttpResponse> {
|
||||
render(id.to_string(), "confidence".to_string()).await
|
||||
}
|
||||
|
||||
#[get("/r/{sub}/comments/{id}/{title}/{sort}")]
|
||||
async fn sorted(web::Path((_sub, id, _title, sort)): web::Path<(String, String, String, String)>) -> Result<HttpResponse> {
|
||||
render(id.to_string(), sort).await
|
||||
async fn page(web::Path((_sub, id)): web::Path<(String, String)>, params: web::Query<Params>) -> Result<HttpResponse> {
|
||||
match ¶ms.sort {
|
||||
Some(sort) => render(id, sort.to_string()).await,
|
||||
None => render(id, "confidence".to_string()).await,
|
||||
}
|
||||
}
|
||||
|
||||
// UTILITIES
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue