diff options
author | Joey Hess <joey@kitenet.net> | 2013-11-17 13:07:00 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-11-17 13:07:00 -0400 |
commit | 81aa58e7ca0118fbb6e1b7f53e47f01d260cdbff (patch) | |
tree | 82d05af95741c51e037784f56e7ec5893e4efcaf /IkiWiki | |
parent | e11a87acfa2356eb75e03895e2ecc2eb98f2e298 (diff) | |
download | ikiwiki-81aa58e7ca0118fbb6e1b7f53e47f01d260cdbff.tar ikiwiki-81aa58e7ca0118fbb6e1b7f53e47f01d260cdbff.tar.gz |
comments: Write pending moderation comments to the transient underlay to avoid conflict with only_committed_changes.
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Plugin/comments.pm | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index b1d8578ae..a0ca9f32e 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -35,6 +35,7 @@ sub import { # Load goto to fix up user page links for logged-in commenters IkiWiki::loadplugin("goto"); IkiWiki::loadplugin("inline"); + IkiWiki::loadplugin("transient"); } sub getsetup () { @@ -555,8 +556,8 @@ sub editcomment ($$) { $postcomment=0; if (! $ok) { - $location=unique_comment_location($page, $content, $config{srcdir}, "._comment_pending"); - writefile("$location._comment_pending", $config{srcdir}, $content); + $location=unique_comment_location($page, $content, $IkiWiki::Plugin::transient::transientdir, "._comment_pending"); + writefile("$location._comment_pending", $IkiWiki::Plugin::transient::transientdir, $content); # Refresh so anything that deals with pending # comments can be updated. @@ -681,12 +682,17 @@ sub commentmoderation ($$) { } my $page=IkiWiki::dirname($f); - my $file="$config{srcdir}/$f"; - my $filedir=$config{srcdir}; + my $filedir=$IkiWiki::Plugin::transient::transientdir; + my $file="$filedir/$f"; if (! -e $file) { # old location - $file="$config{wikistatedir}/comments_pending/".$f; - $filedir="$config{wikistatedir}/comments_pending"; + $file="$config{srcdir}/$f"; + $filedir=$config{srcdir}; + if (! -e $file) { + # older location + $file="$config{wikistatedir}/comments_pending/".$f; + $filedir="$config{wikistatedir}/comments_pending"; + } } if ($action eq 'Accept') { @@ -800,6 +806,8 @@ sub comments_pending () { chdir($origdir) || die "chdir $origdir: $!"; }; + $find_comments->($IkiWiki::Plugin::transient::transientdir, "._comment_pending"); + # old location $find_comments->($config{srcdir}, "._comment_pending"); # old location $find_comments->("$config{wikistatedir}/comments_pending/", |