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

Add "show_nsfw" to the Community API. #3363

Merged
merged 2 commits into from Jun 27, 2023
Merged

Conversation

tgxn
Copy link
Contributor

@tgxn tgxn commented Jun 26, 2023

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.

// 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) {
Copy link
Member

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?

Copy link
Contributor Author

@tgxn tgxn Jun 27, 2023

Choose a reason for hiding this comment

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

image
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)

Copy link
Member

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.

Copy link
Member

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) {
Copy link
Member

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.

@dessalines dessalines merged commit d1d90af into LemmyNet:main Jun 27, 2023
1 check 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.

None yet

3 participants