diff options
author | Simon Green <sgreen@redhat.com> | 2013-07-09 04:48:49 +0200 |
---|---|---|
committer | Simon Green <sgreen@redhat.com> | 2013-07-09 04:48:49 +0200 |
commit | 8a2ac0569e86483b6825d8b71bca4adbac345a1c (patch) | |
tree | 5c601a279d8bdceaa915060105fc40a16b26373d /Bugzilla/BugMail.pm | |
parent | 9c8b03aa9c8f01da284d39e2726ce609d25866fc (diff) | |
download | bugzilla-8a2ac0569e86483b6825d8b71bca4adbac345a1c.tar.gz bugzilla-8a2ac0569e86483b6825d8b71bca4adbac345a1c.tar.xz |
Bug 885646: Bugzilla::BugMail::_get_diff should rejoin split activity entries
r=glob, a=justdave
Diffstat (limited to 'Bugzilla/BugMail.pm')
-rw-r--r-- | Bugzilla/BugMail.pm | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm index 68962fc66..ee25613b7 100644 --- a/Bugzilla/BugMail.pm +++ b/Bugzilla/BugMail.pm @@ -416,7 +416,8 @@ 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, bugs_activity.id", + {Slice=>{}}, @args); foreach my $diff (@$diffs) { $user_cache->{$diff->{who}} ||= new Bugzilla::User($diff->{who}); @@ -433,7 +434,25 @@ sub _get_diffs { } } - return @$diffs; + my @changes = (); + foreach my $diff (@$diffs) { + # If this is the same field as the previous item, then concatenate + # the data into the same change. + if (scalar(@changes) + && $diff->{field_name} eq $changes[-1]->{field_name} + && $diff->{bug_when} eq $changes[-1]->{bug_when} + && $diff->{who} eq $changes[-1]->{who} + && ($diff->{attach_id} // 0) == ($changes[-1]->{attach_id} // 0) + && ($diff->{comment_id} // 0) == ($changes[-1]->{comment_id} // 0) + ) { + my $old_change = pop @changes; + $diff->{old} = join_activity_entries($diff->{field_name}, $old_change->{old}, $diff->{old}); + $diff->{new} = join_activity_entries($diff->{field_name}, $old_change->{new}, $diff->{new}); + } + push @changes, $diff; + } + + return @changes; } sub _get_new_bugmail_fields { |