diff options
author | Joey Hess <joey@gnu.kitenet.net> | 2009-10-26 13:24:27 -0400 |
---|---|---|
committer | Joey Hess <joey@gnu.kitenet.net> | 2009-10-26 13:24:27 -0400 |
commit | 8dfd5289a970e2a77499a2178c493c2c233ba27e (patch) | |
tree | 5f4906f0cf991dd0dd77316f4587f8a9b4d30994 | |
parent | a8a58a466cd787e4b75328b2e9d689168dd26ba8 (diff) |
moderatedcomments: New plugin to allow comment moderation w/o relying on blogspam.net.
-rw-r--r-- | IkiWiki/Plugin/moderatedcomments.pm | 44 | ||||
-rw-r--r-- | debian/changelog | 2 | ||||
-rw-r--r-- | doc/plugins/comments.mdwn | 3 | ||||
-rw-r--r-- | doc/plugins/moderatedcomments.mdwn | 10 |
4 files changed, 58 insertions, 1 deletions
diff --git a/IkiWiki/Plugin/moderatedcomments.pm b/IkiWiki/Plugin/moderatedcomments.pm new file mode 100644 index 000000000..2555927b7 --- /dev/null +++ b/IkiWiki/Plugin/moderatedcomments.pm @@ -0,0 +1,44 @@ +#!/usr/bin/perl +package IkiWiki::Plugin::moderatedcomments; + +use warnings; +use strict; +use IkiWiki 3.00; + +sub import { + hook(type => "getsetup", id => "moderatedcomments", call => \&getsetup); + hook(type => "checkcontent", id => "moderatedcomments", call => \&checkcontent); +} + +sub getsetup () { + return + plugin => { + safe => 1, + rebuild => 0, + }, + moderate_users => { + type => 'boolean', + example => 1, + description => 'Moderate comments of logged-in users?', + safe => 1, + rebuild => 0, + }, +} + +sub checkcontent (@) { + my %params=@_; + + # only handle comments + return undef unless pagespec_match($params{page}, "postcomment(*)", + location => $params{page}); + + # admins and maybe users can comment w/o moderation + my $session=$params{session}; + my $user=$session->param("name") if $session; + return undef if defined $user && (IkiWiki::is_admin($user) || + (exists $config{moderate_users} && ! $config{moderate_users})); + + return gettext("comment needs moderation"); +} + +1 diff --git a/debian/changelog b/debian/changelog index 336924317..f517111b3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,8 @@ ikiwiki (3.20091024) UNRELEASED; urgency=low * po: Fix breakage caused by changes to render code. * mdwn: Avoid trying to use multimarkdown if it is not installed. + * moderatedcomments: New plugin to allow comment moderation w/o relying + on blogspam.net. -- Joey Hess <joeyh@debian.org> Mon, 26 Oct 2009 11:53:32 -0400 diff --git a/doc/plugins/comments.mdwn b/doc/plugins/comments.mdwn index 7e2232411..b6d4d252b 100644 --- a/doc/plugins/comments.mdwn +++ b/doc/plugins/comments.mdwn @@ -45,7 +45,8 @@ There are some global options for the setup file: ## comment moderation If you enable the [[blogspam]] plugin, comments that appear spammy will be -held for moderation. Wiki admins can access the comment moderation queue +held for moderation. (Or with the [[moderatedcomments]] plugin, all +comments will be held.) Wiki admins can access the comment moderation queue via a button on their Preferences page. The comments are stored in `.ikiwiki/comments_pending/`, and can be diff --git a/doc/plugins/moderatedcomments.mdwn b/doc/plugins/moderatedcomments.mdwn new file mode 100644 index 000000000..97924d742 --- /dev/null +++ b/doc/plugins/moderatedcomments.mdwn @@ -0,0 +1,10 @@ +[[!template id=plugin name=moderatedcomments author="[[Joey]]"]] +[[!tag type/auth]] + +This plugin causes [[comments]] to be held for manual moderation. +Admins can access the comment moderation queue via their preferences page. + +By default, all comments made by anyone who is not an admin will be held +for moderation. The `moderate_users` setting can be set to false to avoid +moderating comments of logged-in users, while still moderating anonymous +comments. |