This commit is contained in:
spikecodes 2021-09-09 17:28:55 -07:00
parent 668493b72c
commit 6a4191f3b5
No known key found for this signature in database
GPG key ID: 004CECFF9B463BCB
8 changed files with 41 additions and 27 deletions

View file

@ -146,7 +146,7 @@ pub async fn add_quarantine_exception(req: Request<Body>) -> Result<Response<Bod
pub fn can_access_quarantine(req: &Request<Body>, sub: &str) -> bool {
// Determine if the subreddit can be accessed
setting(&req, &format!("allow_quaran_{}", sub.to_lowercase())).parse().unwrap_or_default()
setting(req, &format!("allow_quaran_{}", sub.to_lowercase())).parse().unwrap_or_default()
}
// Sub or unsub by setting subscription cookie using response "Set-Cookie" header
@ -196,7 +196,7 @@ pub async fn subscriptions(req: Request<Body>) -> Result<Response<Body>, String>
// Add each sub name to the subscribed list
sub_list.push(part.to_owned());
// Reorder sub names alphabettically
sub_list.sort_by_key(|a| a.to_lowercase())
sub_list.sort_by_key(|a| a.to_lowercase());
} else if action.contains(&"unsubscribe".to_string()) {
// Remove sub name from subscribed list
sub_list.retain(|s| s.to_lowercase() != part.to_lowercase());