summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/comments.pm
diff options
context:
space:
mode:
Diffstat (limited to 'IkiWiki/Plugin/comments.pm')
-rw-r--r--IkiWiki/Plugin/comments.pm18
1 files changed, 18 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm
index d34951570..f0eec9ace 100644
--- a/IkiWiki/Plugin/comments.pm
+++ b/IkiWiki/Plugin/comments.pm
@@ -22,6 +22,7 @@ sub import {
hook(type => "checkconfig", id => 'comments', call => \&checkconfig);
hook(type => "getsetup", id => 'comments', call => \&getsetup);
hook(type => "preprocess", id => 'comment', call => \&preprocess);
+ hook(type => "preprocess", id => 'commentmoderation', call => \&preprocess_moderation);
# here for backwards compatability with old comments
hook(type => "preprocess", id => '_comment', call => \&preprocess);
hook(type => "sessioncgi", id => 'comment', call => \&sessioncgi);
@@ -251,6 +252,22 @@ sub preprocess {
return $content;
}
+sub preprocess_moderation {
+ my %params = @_;
+
+ $params{desc}=gettext("Comment Moderation")
+ unless defined $params{desc};
+
+ if (length $config{cgiurl}) {
+ return '<a href="'.
+ IkiWiki::cgiurl(do => 'commentmoderation').
+ '">'.$params{desc}.'</a>';
+ }
+ else {
+ return $params{desc};
+ }
+}
+
sub sessioncgi ($$) {
my $cgi=shift;
my $session=shift;
@@ -569,6 +586,7 @@ sub commentmoderation ($$) {
my $added=0;
foreach my $id (keys %vars) {
if ($id =~ /(.*)\._comment(?:_pending)?$/) {
+ $id=decode_utf8($id);
my $action=$cgi->param($id);
next if $action eq 'Defer' && ! $rejectalldefer;