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 site.content_warning, local_site.default_post_listing_mode #4393

Merged
merged 24 commits into from
Feb 16, 2024

Conversation

Nutomic
Copy link
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
pub struct PostQuery<'a> {
#[builder(!default)]
pub local_site: LocalSite,
Copy link
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
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
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
@dullbananas
Copy link
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
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
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.

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

crates/db_views_actor/src/community_view.rs Outdated Show resolved Hide resolved
@Nutomic Nutomic marked this pull request as draft January 26, 2024 21:42
@@ -39,6 +39,8 @@ pub struct Instance {
pub(crate) image: Option<ImageObject>,
#[serde(default)]
pub(crate) language: Vec<LanguageTag>,
/// nonstandard field
pub(crate) content_warning: Option<String>,
Copy link
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
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
Member Author

Nutomic commented Feb 15, 2024

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

@dessalines
Copy link
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