summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Bug.pm
diff options
context:
space:
mode:
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;
}