diff --git a/src/main.rs b/src/main.rs index a5ced89..d8a7d05 100644 --- a/src/main.rs +++ b/src/main.rs @@ -323,12 +323,12 @@ async fn main() { .at("/r/u_:name") .get(|r| async move { Ok(redirect(&format!("/user/{}", r.param("name").unwrap_or_default()))) }.boxed()); - app.at("/r/:sub/subscribe").post(|r| subreddit::subscriptions_filters(r).boxed()); - app.at("/r/:sub/unsubscribe").post(|r| subreddit::subscriptions_filters(r).boxed()); - app.at("/r/:sub/filter").post(|r| subreddit::subscriptions_filters(r).boxed()); - app.at("/r/:sub/unfilter").post(|r| subreddit::subscriptions_filters(r).boxed()); - app.at("/r/:sub/quicklist").post(|r| subreddit::subscriptions_filters(r).boxed()); - app.at("/r/:sub/unquicklist").post(|r| subreddit::subscriptions_filters(r).boxed()); + app.at("/r/:sub/subscribe").post(|r| subreddit::subscriptions_filters_quicklists(r).boxed()); + app.at("/r/:sub/unsubscribe").post(|r| subreddit::subscriptions_filters_quicklists(r).boxed()); + app.at("/r/:sub/filter").post(|r| subreddit::subscriptions_filters_quicklists(r).boxed()); + app.at("/r/:sub/unfilter").post(|r| subreddit::subscriptions_filters_quicklists(r).boxed()); + app.at("/r/:sub/quicklist").post(|r| subreddit::subscriptions_filters_quicklists(r).boxed()); + app.at("/r/:sub/unquicklist").post(|r| subreddit::subscriptions_filters_quicklists(r).boxed()); app.at("/r/:sub/comments/:id").get(|r| post::item(r).boxed()); app.at("/r/:sub/comments/:id/:title").get(|r| post::item(r).boxed()); diff --git a/src/subreddit.rs b/src/subreddit.rs index 759aaea..5f964ef 100644 --- a/src/subreddit.rs +++ b/src/subreddit.rs @@ -211,8 +211,8 @@ pub fn can_access_quarantine(req: &Request, sub: &str) -> bool { setting(req, &format!("allow_quaran_{}", sub.to_lowercase())).parse().unwrap_or_default() } -// Sub, filter, unfilter, or unsub by setting subscription cookie using response "Set-Cookie" header -pub async fn subscriptions_filters(req: Request) -> Result, String> { +// Sub, filter, unfilter, quicklist, unquicklist or unsub by setting subscription cookie using response "Set-Cookie" header +pub async fn subscriptions_filters_quicklists(req: Request) -> Result, String> { let sub = req.param("sub").unwrap_or_default(); let action: Vec = req.uri().path().split('/').map(String::from).collect(); @@ -294,6 +294,8 @@ pub async fn subscriptions_filters(req: Request) -> Result, } else if action.contains(&"quicklist".to_string()) && !quicklist.contains(&part.to_owned()) { // Add each sub name to the filtered list quicklist.push(part.to_owned()); + // Reorder quicklist alphabetically + quicklist.sort_by_key(|a| a.to_lowercase()); } else if action.contains(&"unquicklist".to_string()) { // Remove sub name from filtered list quicklist.retain(|s| s.to_lowercase() != part.to_lowercase()); diff --git a/static/style.css b/static/style.css index 77e2caa..9e171ac 100644 --- a/static/style.css +++ b/static/style.css @@ -535,7 +535,10 @@ aside { #sub_details, #user_actions { display: grid; - grid-template-columns: repeat(2, 1fr); + grid-template-columns: auto 2fr 1fr; + grid-template-rows: 1fr; + grid-column-gap: 0px; + grid-row-gap: 0px; } @media screen and (max-width: 279px) { #sub_actions { display: unset; } @@ -563,7 +566,8 @@ aside { margin-bottom: 20px; } -#sub_quicklist button { +#sub_quicklist button, +#user_quicklist button { padding: 0px; } diff --git a/templates/subreddit.html b/templates/subreddit.html index 5d4b2dd..5584863 100644 --- a/templates/subreddit.html +++ b/templates/subreddit.html @@ -104,6 +104,18 @@ Icon for r/{{ sub.name }}

{{ sub.title }}

r/{{ sub.name }}

+ {% if crate::utils::enable_rss() %} + + + + {% endif %}

{{ sub.description }}

@@ -159,13 +171,6 @@ {% endif %}
- {% if crate::utils::enable_rss() %} - - {% endif %}