mirror of
https://github.com/redlib-org/redlib.git
synced 2025-04-24 07:46:09 +00:00
Simplify sub list editing.
This commit is contained in:
parent
b527735f6f
commit
f14639ee00
1 changed files with 2 additions and 7 deletions
|
@ -80,13 +80,8 @@ pub async fn subscriptions(req: HttpRequest) -> HttpResponse {
|
||||||
|
|
||||||
// Modify sub list based on action
|
// Modify sub list based on action
|
||||||
if action == "subscribe" {
|
if action == "subscribe" {
|
||||||
if sub_list.is_empty() {
|
|
||||||
sub_list = Vec::new();
|
|
||||||
sub_list.push(sub_name);
|
|
||||||
} else if !sub_list.contains(&sub_name) {
|
|
||||||
sub_list.push(sub_name);
|
sub_list.push(sub_name);
|
||||||
sub_list.sort();
|
sub_list.sort();
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
sub_list.retain(|s| s != &sub_name);
|
sub_list.retain(|s| s != &sub_name);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue