From db5bf69868f0c3581f5f016cdcbaf3d6359612b8 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Wed, 3 Jun 2015 14:21:19 +0800 Subject: Bug 1146772: alternative comment ordering isn't supported (newest first, etc) --- extensions/BugModal/lib/ActivityStream.pm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'extensions') diff --git a/extensions/BugModal/lib/ActivityStream.pm b/extensions/BugModal/lib/ActivityStream.pm index 97edf2ee6..4d399854f 100644 --- a/extensions/BugModal/lib/ActivityStream.pm +++ b/extensions/BugModal/lib/ActivityStream.pm @@ -61,7 +61,17 @@ sub activity_stream { @{ $change_set->{activity} } ]; } - $self->{activity_stream} = [ sort { $a->{time} <=> $b->{time} } @$stream ]; + my $order = Bugzilla->user->setting('comment_sort_order'); + if ($order eq 'oldest_to_newest') { + $self->{activity_stream} = [ sort { $a->{time} <=> $b->{time} } @$stream ]; + } + elsif ($order eq 'newest_to_oldest') { + $self->{activity_stream} = [ sort { $b->{time} <=> $a->{time} } @$stream ]; + } + elsif ($order eq 'newest_to_oldest_desc_first') { + my $desc = shift @$stream; + $self->{activity_stream} = [ $desc, sort { $b->{time} <=> $a->{time} } @$stream ]; + } } return $self->{activity_stream}; } -- cgit v1.2.3-24-g4f1b