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

On registration set show_nsfw based on site.content_warning #4616

Merged
merged 2 commits into from May 7, 2024

Conversation

Nutomic
Copy link
Member

@Nutomic Nutomic commented Apr 11, 2024

To make this work properly, lemmy-ui during registration should send show_nsfw = null if the user doesnt choose a value manually. Or set the default value for show_nsfw based on site.content_warning.

Copy link
Member

@dessalines dessalines left a comment

Choose a reason for hiding this comment

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

Since its required -> optional, it should be non-breaking change.

@dullbananas
Copy link
Collaborator

set the default value for show_nsfw based on site.content_warning.

This is the only reasonable option. Making show_nsfw in the form optional is not useful for that, and it just adds complexity.

@Nutomic
Copy link
Member Author

Nutomic commented Apr 12, 2024

@dullbananas That would mean removing the Register.show_nsfw parameter, which would be a breaking change.

@dessalines
Copy link
Member

It wouldn't necessarily remove it, just completely ignore it (only when site.content_warning exists). If site.content_warning doesn't exist, show_nsfw is still necessary.

Either approach works for me.

@SleeplessOne1917
Copy link
Member

I brought up another related point in my frontend PR for this:

How should the content_warning site setting interact with the enable_nsfw site setting? I assume that content_warning should not be able to have a value when enable_nsfw is off. However, if I understand correctly, having enable_nsfw set to true while content_warning is blank still blurs nsfw images by default, while the blurring is disabled if a content_warning is set. I think it's pretty unintuitive, since the relation between the content warning and post blurring is not clear from just looking at the settings.

@dullbananas
Copy link
Collaborator

set the default value for show_nsfw based on site.content_warning.

I thought that meant the initial checkbox value.

I think making show_nsfw optional and removing the checkbox in lemmy-ui is the best solution.

@dullbananas
Copy link
Collaborator

Also this seems to be a breaking change for crates that depend on the api_common crate

@Nutomic
Copy link
Member Author

Nutomic commented Apr 15, 2024

It wouldn't necessarily remove it, just completely ignore it (only when site.content_warning exists). If site.content_warning doesn't exist, show_nsfw is still necessary.

In that case I would expect bug reports that the show_nsfw param is broken.

@SleeplessOne1917
Copy link
Member

I just made it so enable NSFW is automatically selected when content warning is defined in my UI PR.

@dessalines
Copy link
Member

Whats the consensus then? bool or Option<bool>

@Nutomic
Copy link
Member Author

Nutomic commented Apr 16, 2024

If we leave Register.show_nsfw as bool then we cant set it in the backend based on content warning. Thats only possible if the param is not sent by clients. Then we should just close this pr which is also okay for me. But it seems a bit easier for clients if they have one less mandatory parameter to worry about.

@Nutomic
Copy link
Member Author

Nutomic commented May 7, 2024

Do we merge this or not?

Copy link
Member

@dessalines dessalines left a comment

Choose a reason for hiding this comment

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

Ya I think its good.

@dessalines dessalines merged commit cfdc732 into main May 7, 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.

None yet

4 participants