sort comment queue by time, newest first

master
Joey Hess 2009-01-25 19:45:56 -05:00
parent 7a7e28c55f
commit 4e21af7671
1 changed files with 4 additions and 3 deletions

View File

@ -598,7 +598,7 @@ sub commentmoderation ($$) {
} }
my @comments=map { my @comments=map {
my $id=$_; my ($id, $ctime)=@{$_};
my $file="$config{wikistatedir}/comments_pending/$id"; my $file="$config{wikistatedir}/comments_pending/$id";
my $content=readfile($file); my $content=readfile($file);
my $ctime=(stat($file))[10]; my $ctime=(stat($file))[10];
@ -607,7 +607,7 @@ sub commentmoderation ($$) {
view => previewcomment($content, $id, view => previewcomment($content, $id,
IkiWiki::dirname($_), $ctime), IkiWiki::dirname($_), $ctime),
} }
} comments_pending(); } sort { $b->[1] <=> $a->[1] } comments_pending();
my $template=template("commentmoderation.tmpl"); my $template=template("commentmoderation.tmpl");
$template->param( $template->param(
@ -649,8 +649,9 @@ sub comments_pending () {
$File::Find::prune=0; $File::Find::prune=0;
my ($f)=/$config{wiki_file_regexp}/; # untaint my ($f)=/$config{wiki_file_regexp}/; # untaint
if (defined $f && $f =~ /\Q._comment\E$/) { if (defined $f && $f =~ /\Q._comment\E$/) {
my $ctime=(stat($f))[10];
$f=~s/^\Q$dir\E\/?//; $f=~s/^\Q$dir\E\/?//;
push @ret, $f; push @ret, [$f, $ctime];
} }
} }
} }