Opened 19 years ago

Closed 19 years ago

Last modified 18 years ago

#802 closed defect (duplicate)

add a spam-filter callback facility to comments

Reported by: hugo Owned by: Adrian Holovaty
Component: Tools Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The comment system currently doesn't provide any way to make use of the is_public and approved flags - but I think they could be used for good. For example an approved comment could be shown with active links, while an unapproved one would be shown without active links. And a is_public=False one wouldn't be shown at all. This could be managed manually by the admin in the Django admin interface, but I think that's cumbersome for sites with heavy comment traffic (or with a heavy comment-spam problem!). So I think there should be something like

COMMENT_SPAM_FILTERS = (
   'django.contrib.spamfilters.count_links',
)

in the settings that would allow users to hook up several filters that are run on free comments before they hit the database. The sample one would just use the number of links in the comment to decide wether it might be spam or not. There could be others that do other checks on comment data and request data. Those filters would need to get the request object passed in, so they can look at headers (as those are often a giveaway on spammers).

Sure, an alternative would be to switch to a registered comment system, but not everybody likes that. Free comments are a nice and uncomplicated way, but we already know for sure that free comments will sooner or later be hit by comment spam, so we should at least provide the infrastructure to hook up spam filters.

Change History (3)

comment:1 by Adrian Holovaty, 19 years ago

is_public and approved flags are for use in templates.

{% if comment.is_public %}Display the comment{% endif %}

comment:2 by hugo, 19 years ago

Sure, that's ok - but you can't use them with get_comment_count, as that doesn't take it into account and so you say "3 comments" on your front page while the actual page only shows one comment, because only that one is public :-)

Actually this targets more #801, as that is about inconsistency in the comments app. The "spam filter hook" idea was just something that sprang to mind while writing that one - it would be quite cool if there was a way to handle at least part of the hassel of comment moderation automatically. Sure, I can do that with cronjobs and external tools just fine, but it would still be useful, I think, to have something like that integrated.

comment:3 by hugo, 19 years ago

Resolution: duplicate
Status: newclosed

#979 is a more concrete ticket than this, so this is closed.

Note: See TracTickets for help on using tickets.
Back to Top