mirror of
https://github.com/redlib-org/redlib.git
synced 2025-06-07 23:27:51 +00:00
Change subscription to get. Add subs to settings.
This commit is contained in:
parent
dc2030e6f3
commit
449899962a
5 changed files with 62 additions and 21 deletions
|
@ -103,7 +103,16 @@ pub async fn subscriptions(req: HttpRequest) -> HttpResponse {
|
|||
}
|
||||
|
||||
// Redirect back to subreddit
|
||||
let path = format!("/r/{}", sub);
|
||||
// check for redirect parameter if unsubscribing from outside sidebar
|
||||
let redirect_path = param(&format!("{}?{}", req.path(), req.query_string()), "redirect");
|
||||
let path;
|
||||
|
||||
if redirect_path.len() > 1 && redirect_path.chars().nth(0).unwrap() == '/' {
|
||||
path = redirect_path;
|
||||
} else {
|
||||
path = format!("/r/{}", sub);
|
||||
}
|
||||
|
||||
res
|
||||
.content_type("text/html")
|
||||
.set_header("Location", path.to_string())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue