Add site.content_warning, local_site.default_post_listing_mode#4393
Add site.content_warning, local_site.default_post_listing_mode#4393dessalines merged 24 commits intomainfrom
Conversation
5503f76 to
d8aa6b3
Compare
| #[builder(field_defaults(default))] | ||
| pub struct PostQuery<'a> { | ||
| #[builder(!default)] | ||
| pub local_site: LocalSite, |
There was a problem hiding this comment.
Need to change this to builder to ensure that LocalSite gets passed in. Using Default is not a good idea because LocalSite itself implements Default, so it would be very easy to forget the parameter.
There was a problem hiding this comment.
LocalSite can instead be added to the list function's parameters, which is how non-optional PersonId is done for other views if i remember correctly
There was a problem hiding this comment.
Youre right, I could figure this out but now I got it. Wasted a lot of time rewriting all the code and tests to use builder.
|
Content warning should be in Site instead of LocalSite so it can be federated in the future. This would allow it to be included in PostView and CommmunityView. Clients can use this to show the content warning before showing an image or community. |
2bcef2d to
52225e6
Compare
|
@dullbananas Makes sense, changed it and made it federate. |
a53bf2c to
87954f0
Compare
dessalines
left a comment
There was a problem hiding this comment.
1 comment, but other than that it looks good. Feel free to merge whenever.
| #[serde(default)] | ||
| pub(crate) language: Vec<LanguageTag>, | ||
| /// nonstandard field | ||
| pub(crate) content_warning: Option<String>, |
There was a problem hiding this comment.
Need to look for a standard compliant way to federate this.
There was a problem hiding this comment.
Saldy I cant find anything as we are already using content and summary. Have to leave it like this.
|
Looks like we forgot about this. Its good to merge right? |
|
Yep seems fine. |
I noticed that lemmynsfw runs a fork with some reasonable changes, and decided to integrate them into Lemmy. Specifically there is a new optional value
LocalSite.content_warning. If it is present, nsfw posts/communities are shown by default. Also frontends and apps should display the content warning when the instance is opened for the first time, and nsfw images shouldnt be blurred. There is also a community settingonly_followers_can_votewith relevant adjustments in lemmy-ui to disable vote buttons.You can see the forked code under these links (switch to "Files changed" tab):
The frontend also has an additional changes to expand images by default, we could add a backend setting for this too.