]> sipb.mit.edu Git - ikiwiki.git/commitdiff
comments: Write pending moderation comments to the transient underlay to avoid confli...
authorJoey Hess <joey@kitenet.net>
Sun, 17 Nov 2013 17:07:00 +0000 (13:07 -0400)
committerJoey Hess <joey@kitenet.net>
Sun, 17 Nov 2013 17:07:00 +0000 (13:07 -0400)
IkiWiki/Plugin/comments.pm
debian/changelog
doc/plugins/transient.mdwn
doc/roadmap.mdwn

index b1d8578ae04b3512866e21b42a53cb31b1a9ca08..a0ca9f32e484090969fbfa605875268cd112e9d8 100644 (file)
@@ -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/",
index e7856c01b7d90886f46824b0f4e165b951e5cc62..1eb3de6dc1f02256829c4dc01f1fb05533d69dac 100644 (file)
@@ -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
 
index b7dd11906afc0eb28384e5c3d4d2ef8427b77fce..8649262c6c577102ac32d65bbe1918f1cc74446e 100644 (file)
@@ -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
index f2ff5802ec30747584ba9510fcad679e4213e3af..bc8f4d82416aa3afef54a7b3d09662d2833dad17 100644 (file)
@@ -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