Skip to content

Fix default post sort setting not applied until settings are saved#521

Open
Sparronator9999 wants to merge 1 commit intoredlib-org:mainfrom
Sparronator9999:post-sort-fix
Open

Fix default post sort setting not applied until settings are saved#521
Sparronator9999 wants to merge 1 commit intoredlib-org:mainfrom
Sparronator9999:post-sort-fix

Conversation

@Sparronator9999
Copy link
Copy Markdown

Before this commit, the instance default post sort will not be applied until the user saves (not even changes) their settings at least once. See #501 for a detailed description of the bug. This PR changes the subreddit page to try the instance default setting if no cookie exists (using an existing utility function that appears to already be used everywhere else - perhaps post sort was forgotten when the function was first introduced?)

Fixes #501.

@dave0003
Copy link
Copy Markdown

dave0003 commented Apr 5, 2026

This fails to compile for me. I think its just missing a semicolon.

error: expected `;`, found keyword `let`
  --> src/subreddit.rs:70:44
   |
70 |     let post_sort = setting(&req, "post_sort")
   |                                               ^ help: add `;` here
71 |     let sort = req.param("sort").unwrap_or_else(|| req.param("id").unwrap_or(post_sort));
   |     --- unexpected token

error: could not compile `redlib` (lib) due to 1 previous error

@Sparronator9999
Copy link
Copy Markdown
Author

This fails to compile for me. I think its just missing a semicolon.

I don't know how this happened (I tested this change before making the PR), but the missing semicolon should be fixed now.

@dave0003
Copy link
Copy Markdown

dave0003 commented Apr 6, 2026

This fails to compile for me. I think its just missing a semicolon.

I don't know how this happened (I tested this change before making the PR), but the missing semicolon should be fixed now.

Thank you. I can confirm it's merging and compiling now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Bug Report: Default post sort does not apply until settings are saved at least once

2 participants