X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/a2989598884807ace2a9efd248b7c32824cf6c6f..192ce7a238af9021b0fd6dd571f22409af81ebaf:/IkiWiki/Plugin/comments.pm diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index 17cd99c3b..64eb7fb09 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -142,8 +142,6 @@ sub preprocess { } $content =~ s/\\"/"/g; - $content = IkiWiki::filter($page, $params{destpage}, $content); - if ($config{comments_allowdirectives}) { $content = IkiWiki::preprocess($page, $params{destpage}, $content); @@ -177,7 +175,7 @@ sub preprocess { if (defined $oiduser) { # looks like an OpenID $commentauthorurl = $commentuser; - $commentauthor = $oiduser; + $commentauthor = (defined $params{nickname} && length $params{nickname}) ? $params{nickname} : $oiduser; $commentopenid = $commentuser; } else { @@ -396,14 +394,18 @@ sub editcomment ($$) { my $content = "[[!comment format=$type\n"; - # FIXME: handling of double quotes probably wrong? if (defined $session->param('name')) { my $username = $session->param('name'); $username =~ s/"/"/g; $content .= " username=\"$username\"\n"; } - elsif (defined $ENV{REMOTE_ADDR}) { - my $ip = $ENV{REMOTE_ADDR}; + if (defined $session->param('nickname')) { + my $nickname = $session->param('nickname'); + $nickname =~ s/"/"/g; + $content .= " nickname=\"$nickname\"\n"; + } + elsif (defined $session->remote_addr()) { + my $ip = $session->remote_addr(); if ($ip =~ m/^([.0-9]+)$/) { $content .= " ip=\"$1\"\n"; } @@ -513,8 +515,10 @@ sub editcomment ($$) { IkiWiki::rcs_add($file); IkiWiki::disable_commit_hook(); - $conflict = IkiWiki::rcs_commit_staged($message, - $session->param('name'), $ENV{REMOTE_ADDR}); + $conflict = IkiWiki::rcs_commit_staged( + message => $message, + session => $session, + ); IkiWiki::enable_commit_hook(); IkiWiki::rcs_update(); } @@ -602,8 +606,10 @@ sub commentmoderation ($$) { if ($config{rcs} and $config{comments_commit}) { my $message = gettext("Comment moderation"); IkiWiki::disable_commit_hook(); - $conflict=IkiWiki::rcs_commit_staged($message, - $session->param('name'), $ENV{REMOTE_ADDR}); + $conflict=IkiWiki::rcs_commit_staged( + message => $message, + session => $session, + ); IkiWiki::enable_commit_hook(); IkiWiki::rcs_update(); } @@ -669,7 +675,7 @@ sub comments_pending () { my $extension=shift; return unless -d $dir; - chdir($dir) || die "chdir: $!"; + chdir($dir) || die "chdir $dir: $!"; find({ no_chdir => 1, @@ -686,7 +692,7 @@ sub comments_pending () { } }, "."); - chdir($origdir) || die "chdir: $!"; + chdir($origdir) || die "chdir $origdir: $!"; }; $find_comments->($config{srcdir}, "._comment_pending");