summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2009-01-25 19:45:56 -0500
committerJoey Hess <joey@kitenet.net>2009-01-25 19:45:56 -0500
commit4e21af767175cdf19143b0b0776e111de3253103 (patch)
tree85558de93d8de1ec27e7fadf3b442fc562bd0d94
parent7a7e28c55f1ffa64eedbaf36ee1729c6bbd27762 (diff)
sort comment queue by time, newest first
-rw-r--r--IkiWiki/Plugin/comments.pm7
1 files changed, 4 insertions, 3 deletions
diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm
index c95f77a42..f0b67a9eb 100644
--- a/IkiWiki/Plugin/comments.pm
+++ b/IkiWiki/Plugin/comments.pm
@@ -598,7 +598,7 @@ sub commentmoderation ($$) {
}
my @comments=map {
- my $id=$_;
+ my ($id, $ctime)=@{$_};
my $file="$config{wikistatedir}/comments_pending/$id";
my $content=readfile($file);
my $ctime=(stat($file))[10];
@@ -607,7 +607,7 @@ sub commentmoderation ($$) {
view => previewcomment($content, $id,
IkiWiki::dirname($_), $ctime),
}
- } comments_pending();
+ } sort { $b->[1] <=> $a->[1] } comments_pending();
my $template=template("commentmoderation.tmpl");
$template->param(
@@ -649,8 +649,9 @@ sub comments_pending () {
$File::Find::prune=0;
my ($f)=/$config{wiki_file_regexp}/; # untaint
if (defined $f && $f =~ /\Q._comment\E$/) {
+ my $ctime=(stat($f))[10];
$f=~s/^\Q$dir\E\/?//;
- push @ret, $f;
+ push @ret, [$f, $ctime];
}
}
}