Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a show_read override to GetPosts. #4846

Merged
merged 5 commits into from
Jun 21, 2024
Merged

Conversation

dessalines
Copy link
Member

- If show_read is true, it overrides the local user show_read
  setting.
- Fixes #4124
@dullbananas
Copy link
Collaborator

show_read: Some(false) doesn't override the user setting, which could cause confusion. Use Option<bool> in PostQuery.

@dessalines
Copy link
Member Author

I've updated to make all of the post and comment query params as options.

Copy link
Collaborator

@dullbananas dullbananas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing to Option<bool> is not needed for fields other than show_read because they have the same default value every time, unlike show_read which overrides a LocalUser field.

If the inconsistency of using both bool and Option<bool> is a problem, then you can either:

  • Keep these changes (except for the change to page_back in my opinion)
  • Use bool instead of Option<bool>, remove the Default derive, and create this function that's does the same thing as Default::default except it sets local_user: local_user, show_read: local_user.show_read_posts():
    fn new(local_user: Option<&'a LocalUser>) -> Self
    

crates/db_views/src/post_view.rs Outdated Show resolved Hide resolved
@dessalines dessalines merged commit d09854a into main Jun 21, 2024
2 checks passed
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.

Ignore user filters per request
4 participants