From: Joey Hess Date: Fri, 12 Nov 2010 06:06:56 +0000 (-0400) Subject: comments: Make comment() pagespec also match comments that are being posted. X-Git-Tag: 3.20100815.2~5 X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/669fbe267a1785a4d73321040760e457ac5576f7 comments: Make comment() pagespec also match comments that are being posted. (cherry picked from commit d8de98911ec98f9e4560ab2939b4edf8fb04066b) Conflicts: debian/changelog --- diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index 57f5b1304..a39dab36c 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -947,14 +947,16 @@ sub match_comment ($$;@) { my $page = shift; my $glob = shift; - # To see if it's a comment, check the source file type. - # Deal with comments that were just deleted. - my $source=exists $IkiWiki::pagesources{$page} ? - $IkiWiki::pagesources{$page} : - $IkiWiki::delpagesources{$page}; - my $type=defined $source ? IkiWiki::pagetype($source) : undef; - if (! defined $type || $type ne "_comment") { - return IkiWiki::FailReason->new("$page is not a comment"); + if (! $postcomment) { + # To see if it's a comment, check the source file type. + # Deal with comments that were just deleted. + my $source=exists $IkiWiki::pagesources{$page} ? + $IkiWiki::pagesources{$page} : + $IkiWiki::delpagesources{$page}; + my $type=defined $source ? IkiWiki::pagetype($source) : undef; + if (! defined $type || $type ne "_comment") { + return IkiWiki::FailReason->new("$page is not a comment"); + } } return match_glob($page, "$glob/*", internal => 1, @_); diff --git a/debian/changelog b/debian/changelog index f94f69fd1..ab10e142e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,6 +16,8 @@ ikiwiki (3.20100815.2) UNRELEASED; urgency=low comments, but leave your blog posts unscrubbed, etc. * comments: Make postcomment() pagespec work when previewing a comment, including during moderation. + * comments: Make comment() pagespec also match comments that are being + posted. -- Joey Hess Sun, 15 Aug 2010 11:42:55 -0400