-
-
Notifications
You must be signed in to change notification settings - Fork 871
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
Add "show_nsfw" to the Community API. #3363
Conversation
// No person in request, only show nsfw communities if show_nsfw passed into request | ||
if !self.local_user.map(|l| l.show_nsfw).unwrap_or(false) { | ||
// No person in request, only show nsfw communities if show_nsfw is passed into request | ||
if !self.show_nsfw.unwrap_or(false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What you replaced should be illuminating.
You are overriding / ignoring the users show_nsfw preference. Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not the first part of this condition check where there IS a local user?
The else
path looks like it should only execute when there is no local user.
I'm not full bottle on the syntax in rust, though. I tested this using docker-compose and it still appears to respect my users' show_nsfw
preference when logged in. (and the show_nsfw
query param worked on /community/list
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep this looks correct, it makes no sense to check for local user in else branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahhh okay I see that now, sry.
// No person in request, only show nsfw communities if show_nsfw passed into request | ||
if !self.local_user.map(|l| l.show_nsfw).unwrap_or(false) { | ||
// No person in request, only show nsfw communities if show_nsfw is passed into request | ||
if !self.show_nsfw.unwrap_or(false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahhh okay I see that now, sry.
This functionality seems to have been removed in 0.18.0, the comment references a non-existant flag, and also seems to look at
self.local_user
where it would not be defined.I added a
show_nsfw
query parameter that can be used to show all communities.