diff options
author | lpsolit%gmail.com <> | 2005-04-09 09:37:50 +0200 |
---|---|---|
committer | lpsolit%gmail.com <> | 2005-04-09 09:37:50 +0200 |
commit | 61898d18479013cfbcc820ff25f39377db071536 (patch) | |
tree | b575fb4c72da32a5b641e9bad1fafd9499c5e9c1 /Bugzilla/Bug.pm | |
parent | 940a96d61b436ebc94de8023395ddbbc0d9c7272 (diff) | |
download | bugzilla-61898d18479013cfbcc820ff25f39377db071536.tar.gz bugzilla-61898d18479013cfbcc820ff25f39377db071536.tar.xz |
Bug 199048: Preference option to reverse sort the comments stack - Patch by Shane H. W. Travis <shane.h.w.travis@gmail.com> r=mkanat a=myk
Diffstat (limited to 'Bugzilla/Bug.pm')
-rwxr-xr-x | Bugzilla/Bug.pm | 12 |
1 files changed, 10 insertions, 2 deletions
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; } |