mirror of
https://github.com/redlib-org/redlib.git
synced 2025-05-15 06:22:50 +00:00
Add user following functionality
This commit is contained in:
parent
4a42a25ed3
commit
b3e4b7bfae
6 changed files with 35 additions and 16 deletions
|
@ -35,18 +35,19 @@ pub async fn community(req: Request<Body>) -> Result<Response<Body>, String> {
|
|||
let post_sort = req.cookie("post_sort").map_or_else(|| "hot".to_string(), |c| c.value().to_string());
|
||||
let sort = req.param("sort").unwrap_or_else(|| req.param("id").unwrap_or(post_sort));
|
||||
|
||||
let sub = req.param("sub").map_or(
|
||||
if front_page == "default" || front_page.is_empty() {
|
||||
if subscribed.is_empty() {
|
||||
"popular".to_string()
|
||||
} else {
|
||||
subscribed.to_owned()
|
||||
}
|
||||
let sub = req.param("sub").unwrap_or(if front_page == "default" || front_page.is_empty() {
|
||||
if subscribed.is_empty() {
|
||||
"popular".to_string()
|
||||
} else {
|
||||
front_page.to_owned()
|
||||
},
|
||||
String::from,
|
||||
);
|
||||
subscribed.to_owned()
|
||||
}
|
||||
} else {
|
||||
front_page.to_owned()
|
||||
});
|
||||
|
||||
if req.param("sub").is_some() && sub.starts_with("u_") {
|
||||
return Ok(redirect(["/user/", &sub[2..]].concat()));
|
||||
}
|
||||
|
||||
let path = format!("/r/{}/{}.json?{}&raw_json=1", sub, sort, req.uri().query().unwrap_or_default());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue