aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2013-11-17 13:07:00 -0400
committerJoey Hess <joey@kitenet.net>2013-11-17 13:07:00 -0400
commit81aa58e7ca0118fbb6e1b7f53e47f01d260cdbff (patch)
tree82d05af95741c51e037784f56e7ec5893e4efcaf
parente11a87acfa2356eb75e03895e2ecc2eb98f2e298 (diff)
downloadikiwiki-81aa58e7ca0118fbb6e1b7f53e47f01d260cdbff.tar
ikiwiki-81aa58e7ca0118fbb6e1b7f53e47f01d260cdbff.tar.gz
comments: Write pending moderation comments to the transient underlay to avoid conflict with only_committed_changes.
-rw-r--r--IkiWiki/Plugin/comments.pm20
-rw-r--r--debian/changelog2
-rw-r--r--doc/plugins/transient.mdwn3
-rw-r--r--doc/roadmap.mdwn5
4 files changed, 21 insertions, 9 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/",
diff --git a/debian/changelog b/debian/changelog
index e7856c01b..1eb3de6dc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,8 @@ ikiwiki (3.20130904.2) UNRELEASED; urgency=low
refresh by querying git to find the files that were changed, rather
than looking at the work tree. Not enabled by default as it can
break some setups where not all files get committed to git.
+ * comments: Write pending moderation comments to the transient underlay
+ to avoid conflict with only_committed_changes.
-- Joey Hess <joeyh@debian.org> Thu, 05 Sep 2013 10:01:10 -0400
diff --git a/doc/plugins/transient.mdwn b/doc/plugins/transient.mdwn
index b7dd11906..8649262c6 100644
--- a/doc/plugins/transient.mdwn
+++ b/doc/plugins/transient.mdwn
@@ -16,8 +16,7 @@ This plugin is mostly useful as something that other plugins can depend on:
* [[plugins/autoindex]] can be configured to auto-create missing
pages that have a [[ikiwiki/subpage]] or an [[plugins/attachment]], but not
commit them, in which case they go in the transient underlay
-* [[plugins/comments]] can be configured to not commit comments: if so, it
- puts them in the transient underlay
+* [[plugins/comments]] writes comments pending moderation to the transient underlay
* [[plugins/recentchanges]] writes new changes into the transient underlay
* [[plugins/tag]] can be configured to auto-create missing
tag pages but not commit them, in which case they go in the transient
diff --git a/doc/roadmap.mdwn b/doc/roadmap.mdwn
index f2ff5802e..bc8f4d824 100644
--- a/doc/roadmap.mdwn
+++ b/doc/roadmap.mdwn
@@ -80,7 +80,10 @@ Probably incomplete list:
* Enable tagbase by default (so that tag autocreation will work by default).
Note that this is already done for wikis created by `auto-blog.setup`.
* [[tips/html5]] on by default (some day..)
-* Remove support for old `.ikiwiki/comments_pending` from comment plugin.
+* Remove support for old `.ikiwiki/comments_pending` and for
+ pending comments located in the srcdir, rather than transient underlay,
+ from comment plugin. That support makes comment moderation slow as
+ it has to check all the old locations.
In general, we try to use [[ikiwiki-transition]] or forced rebuilds on
upgrade to deal with changes that break compatability. Some things that