summaryrefslogtreecommitdiffstats
path: root/Bugzilla/BugMail.pm
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2012-06-27 10:15:51 +0200
committerByron Jones <bjones@mozilla.com>2012-06-27 10:15:51 +0200
commit2eaefe2301feb27594a3db755948fbddb3594838 (patch)
treec3c5b5aa3238bd0b022e5c1aafda7ed70f739cf7 /Bugzilla/BugMail.pm
parent06feb186d98d718264671e8079ccd01d20935165 (diff)
downloadbugzilla-2eaefe2301feb27594a3db755948fbddb3594838.tar.gz
bugzilla-2eaefe2301feb27594a3db755948fbddb3594838.tar.xz
Bug 764430: improvements to 4.2 bugmail
Diffstat (limited to 'Bugzilla/BugMail.pm')
-rw-r--r--Bugzilla/BugMail.pm18
1 files changed, 16 insertions, 2 deletions
diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm
index c7a682e4a..2a70127f1 100644
--- a/Bugzilla/BugMail.pm
+++ b/Bugzilla/BugMail.pm
@@ -47,7 +47,7 @@ use Bugzilla::Hook;
use Date::Parse;
use Date::Format;
use Scalar::Util qw(blessed);
-use List::MoreUtils qw(uniq);
+use List::MoreUtils qw(uniq firstidx);
use constant BIT_DIRECT => 1;
use constant BIT_WATCHING => 2;
@@ -490,7 +490,7 @@ sub _get_diffs {
ON fielddefs.id = bugs_activity.fieldid
WHERE bugs_activity.bug_id = ?
$when_restriction
- ORDER BY bugs_activity.bug_when", {Slice=>{}}, @args);
+ ORDER BY bugs_activity.bug_when, fielddefs.description", {Slice=>{}}, @args);
my $referenced_bugs = [];
foreach my $diff (@$diffs) {
@@ -520,6 +520,20 @@ sub _get_new_bugmail_fields {
my @fields = @{ Bugzilla->fields({obsolete => 0, in_new_bugmail => 1}) };
my @diffs;
+ # Show fields in the same order as the DEFAULT_FIELDS list, which mirrors
+ # 4.0's behavour and provides sane grouping of similar fields.
+ # Any additional fields are sorted by descrsiption
+ my @prepend;
+ foreach my $name (map { $_->{name} } Bugzilla::Field::DEFAULT_FIELDS) {
+ my $idx = firstidx { $_->name eq $name } @fields;
+ if ($idx != -1) {
+ push(@prepend, $fields[$idx]);
+ splice(@fields, $idx, 1);
+ }
+ }
+ @fields = sort { $a->description cmp $b->description } @fields;
+ @fields = (@prepend, @fields);
+
foreach my $field (@fields) {
my $name = $field->name;
my $value = $bug->$name;