From 61898d18479013cfbcc820ff25f39377db071536 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Sat, 9 Apr 2005 07:37:50 +0000 Subject: Bug 199048: Preference option to reverse sort the comments stack - Patch by Shane H. W. Travis r=mkanat a=myk --- Bugzilla/Bug.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'Bugzilla/Bug.pm') diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 5017196b3..8accc452c 100755 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -761,7 +761,11 @@ sub ValidateTime { } sub GetComments { - my ($id) = (@_); + my ($id, $comment_sort_order) = (@_); + $comment_sort_order = $comment_sort_order || + Bugzilla->user->settings->{'comment_sort_order'}->{'value'}; + + my $sort_order = ($comment_sort_order eq "oldest_to_newest") ? 'asc' : 'desc'; my $dbh = Bugzilla->dbh; my @comments; my $sth = $dbh->prepare( @@ -774,7 +778,7 @@ sub GetComments { FROM longdescs, profiles WHERE profiles.userid = longdescs.who AND longdescs.bug_id = ? - ORDER BY longdescs.bug_when"); + ORDER BY longdescs.bug_when $sort_order"); $sth->execute($id); while (my $comment_ref = $sth->fetchrow_hashref()) { @@ -789,6 +793,10 @@ sub GetComments { push (@comments, \%comment); } + + if ($comment_sort_order eq "newest_to_oldest_desc_first") { + unshift(@comments, pop @comments); + } return \@comments; } -- cgit v1.2.3-24-g4f1b