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

Slur Filter Warning #867

Merged
merged 14 commits into from
Jan 28, 2024
Merged

Slur Filter Warning #867

merged 14 commits into from
Jan 28, 2024

Conversation

Sjmarf
Copy link
Contributor

@Sjmarf Sjmarf commented Jan 20, 2024

Background

Lemmy allows instances to set a slur filter. Users cannot create posts that match the filter regex. The user can create a comment that matches the regex - however, all matches contained within the comment are replaced with *removed*.

Implementation

This PR modifies the PostComposerView to show a "xyz" is disallowed banner if the post matches the slur filter regex. The regex is checked dynamically every time the post content is modified.

This improves the user experience - previously, the user would just get an "error: slur" notification, with no hint of where in the post the slur is. This could have been confusing, especially if a slur was included accidentally as part of another word, or the user was unaware that their instance blocked a certain word (an example would be "bitch" on lemmy.ml).


What about comments?

Edit: Added for comments too!

Original message:

Should I implement something similar for comments? Lemmy doesn't actually stop the user from posting a comment containing slurs. I'm not sure what the best approach is here. Do we stop the user from posting their comment? Do we still allow them to post, but give them a warning? Or do we not do anything at all?

@Sjmarf Sjmarf added the enhancement New feature or request label Jan 20, 2024
@Sjmarf Sjmarf requested a review from a team as a code owner January 20, 2024 12:11
@Sjmarf Sjmarf requested review from ShadowJonathan and EricBAndrews and removed request for a team January 20, 2024 12:11
@Sjmarf Sjmarf changed the title Slur Filter Slur Filter Warning Jan 20, 2024
Copy link
Member

@EricBAndrews EricBAndrews left a comment

Choose a reason for hiding this comment

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

Looks good! I've left a couple minor suggestions. It also appears that the slur filter does not get reset when switching to an instance with no slur filter:

  • Switch to a lemmy.ml account (or an account on any instance with slur filter)
  • Switch to test-mlem (or an account on any instance without a slur filter)
  • Try to compose a post with a slur
    The slur filter from the previous instance will still be applied

Mlem/Views/Shared/Composer/PostComposerView.swift Outdated Show resolved Hide resolved
Mlem/Views/Shared/Composer/PostComposerView.swift Outdated Show resolved Hide resolved
Mlem/Views/Shared/Composer/ResponseEditorView.swift Outdated Show resolved Hide resolved
@Sjmarf
Copy link
Contributor Author

Sjmarf commented Jan 28, 2024

also appears that the slur filter does not get reset when switching to an instance with no slur filter

Fixed!

Copy link
Member

@EricBAndrews EricBAndrews left a comment

Choose a reason for hiding this comment

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

LGTM!

@Sjmarf Sjmarf merged commit eed8507 into dev Jan 28, 2024
4 checks passed
@Sjmarf Sjmarf deleted the sjmarf/post-composer-tweaks branch January 28, 2024 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants