summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Bug.pm
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2005-04-09 09:37:50 +0200
committerlpsolit%gmail.com <>2005-04-09 09:37:50 +0200
commit61898d18479013cfbcc820ff25f39377db071536 (patch)
treeb575fb4c72da32a5b641e9bad1fafd9499c5e9c1 /Bugzilla/Bug.pm
parent940a96d61b436ebc94de8023395ddbbc0d9c7272 (diff)
downloadbugzilla-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-xBugzilla/Bug.pm12
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;
}