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

Improved spam prevention #2954

Merged
merged 22 commits into from Feb 15, 2024
Merged

Improved spam prevention #2954

merged 22 commits into from Feb 15, 2024

Conversation

ThibaudDauce
Copy link
Contributor

@ThibaudDauce ThibaudDauce commented Feb 1, 2024

Ce qu'il y a à faire pour chaque nouveau modèle que l'on veut protéger :

  • Étendre SpamMixin et override attributes_to_check_for_spam pour mettre les champs que l'on veut checker automatiquement, embeds_to_check_for_spam si on a des sous-ressources à check, spam_report_title et spam_report_link pour les notifs.
  • Créer une nouvelle API qui étend SpamAPI (de la même manière que les follow) pour pouvoir mettre en non spam
  • Utiliser le décorateur @spam_protected() sur les méthodes que l'on ne veut pas exécuter en cas de spam (elles seront automatiquement rejouées lors du passage au non spam)

@ThibaudDauce ThibaudDauce marked this pull request as draft February 1, 2024 17:00
Copy link
Contributor

@maudetes maudetes left a comment

Choose a reason for hiding this comment

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

A WIP review :)

I quite like the SpamMixin pattern.
Not sure I have the entire callbacks logic in mind, I'll need to re-read this part.

We may want to filter on discussions_notifications as well?

requirements/install.pip Outdated Show resolved Hide resolved
udata/core/spam/models.py Outdated Show resolved Hide resolved
udata/core/spam/models.py Outdated Show resolved Hide resolved
udata/core/spam/models.py Outdated Show resolved Hide resolved
udata/tests/test_discussions.py Show resolved Hide resolved
udata/notifications/mattermost.py Outdated Show resolved Hide resolved
udata/core/spam/models.py Outdated Show resolved Hide resolved
udata/core/discussions/api.py Outdated Show resolved Hide resolved
udata/core/spam/api.py Show resolved Hide resolved
@ThibaudDauce ThibaudDauce force-pushed the improved_spam_prevention branch 2 times, most recently from 0203a33 to ce0d383 Compare February 5, 2024 15:47
@ThibaudDauce ThibaudDauce marked this pull request as ready for review February 6, 2024 08:33
@maudetes maudetes self-requested a review February 6, 2024 13:11
@ThibaudDauce ThibaudDauce force-pushed the improved_spam_prevention branch 2 times, most recently from e4ad0e7 to 0a4a91a Compare February 8, 2024 09:41
Copy link
Contributor

@maudetes maudetes left a comment

Choose a reason for hiding this comment

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

Nice! Thank you for this PR and the latest iterations!
I mark as approved as I have only very minor comments.

udata/core/spam/models.py Show resolved Hide resolved
udata/core/spam/api.py Show resolved Hide resolved
udata/core/spam/models.py Outdated Show resolved Hide resolved
@ThibaudDauce ThibaudDauce merged commit d7fbea1 into master Feb 15, 2024
1 check passed
@ThibaudDauce ThibaudDauce deleted the improved_spam_prevention branch March 18, 2024 08:48
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

2 participants