Skip to content

Add site.content_warning, local_site.default_post_listing_mode#4393

Merged
dessalines merged 24 commits intomainfrom
lemmynsfw-changes
Feb 16, 2024
Merged

Add site.content_warning, local_site.default_post_listing_mode#4393
dessalines merged 24 commits intomainfrom
lemmynsfw-changes

Conversation

@Nutomic
Copy link
Copy Markdown
Member

@Nutomic Nutomic commented Jan 22, 2024

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 setting only_followers_can_vote with 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.

Nutomic added a commit to LemmyNet/lemmy-js-client that referenced this pull request Jan 23, 2024
SleeplessOne1917 pushed a commit to LemmyNet/lemmy-js-client that referenced this pull request Jan 23, 2024
Comment thread crates/db_views/src/post_view.rs Outdated
#[builder(field_defaults(default))]
pub struct PostQuery<'a> {
#[builder(!default)]
pub local_site: LocalSite,
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.

@Nutomic Nutomic marked this pull request as ready for review January 23, 2024 14:28
Comment thread migrations/2024-01-22-105746_lemmynsfw-changes/up.sql Outdated
Comment thread migrations/2024-01-22-105746_lemmynsfw-changes/up.sql Outdated
@dullbananas
Copy link
Copy Markdown
Collaborator

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.

@Nutomic
Copy link
Copy Markdown
Member Author

Nutomic commented Jan 24, 2024

@dullbananas Makes sense, changed it and made it federate.

@Nutomic Nutomic marked this pull request as draft January 25, 2024 14:24
@Nutomic Nutomic marked this pull request as ready for review January 25, 2024 14:30
Comment thread crates/api_crud/src/community/list.rs
Comment thread crates/db_schema/src/impls/community.rs Outdated
Copy link
Copy Markdown
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.

1 comment, but other than that it looks good. Feel free to merge whenever.

Comment thread crates/db_views_actor/src/community_view.rs Outdated
@Nutomic Nutomic marked this pull request as draft January 26, 2024 21:42
#[serde(default)]
pub(crate) language: Vec<LanguageTag>,
/// nonstandard field
pub(crate) content_warning: Option<String>,
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Need to look for a standard compliant way to federate this.

Copy link
Copy Markdown
Member Author

@Nutomic Nutomic Jan 29, 2024

Choose a reason for hiding this comment

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

Saldy I cant find anything as we are already using content and summary. Have to leave it like this.

@Nutomic Nutomic changed the title Integrate changes from lemmynsfw fork Add site.content_warning, local_site.default_post_listing_mode Jan 26, 2024
@Nutomic Nutomic marked this pull request as ready for review January 29, 2024 10:28
@dessalines dessalines self-requested a review January 29, 2024 14:26
@Nutomic
Copy link
Copy Markdown
Member Author

Nutomic commented Feb 15, 2024

Looks like we forgot about this. Its good to merge right?

@dessalines
Copy link
Copy Markdown
Member

Yep seems fine.

@dessalines dessalines enabled auto-merge (squash) February 15, 2024 15:37
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.

3 participants