Dzahn has submitted this change and it was merged. Change subject: [4.4] Sync custom file with upstream 4.4 and reapply custom patch ......................................................................
[4.4] Sync custom file with upstream 4.4 and reapply custom patch DO NOT COMMIT until Bugzilla has been upgraded to 4.4. Sync custom file with upstream 4.4 and reapply custom patch for https://bugzilla.wikimedia.org/show_bug.cgi?id=43130 Change-Id: If96219d81b5b05e6513d6c95f524d11c4d1e9aaf --- M Bugzilla/BugMail.pm 1 file changed, 39 insertions(+), 3 deletions(-) Approvals: Dzahn: Verified; Looks good to me, approved diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm index 66330d0..65d3c7c 100644 --- a/Bugzilla/BugMail.pm +++ b/Bugzilla/BugMail.pm @@ -355,6 +355,14 @@ push(@watchingrel, 'None') unless @watchingrel; push @watchingrel, map { user_id_to_login($_) } @$watchingRef; + my @changedfields = uniq map { $_->{field_name} } @display_diffs; + + # Add attachments.created to changedfields if one or more + # comments contain information about a new attachment + if (grep($_->type == CMT_ATTACHMENT_CREATED, @send_comments)) { + push(@changedfields, 'attachments.created'); + } + my $vars = { date => $date, to_user => $user, @@ -365,7 +373,7 @@ reasonswatchheader => join(" ", @watchingrel), changer => $changer, diffs => \@display_diffs, - changedfields => [uniq map { $_->{field_name} } @display_diffs], + changedfields => \@changedfields, new_comments => \@send_comments, threadingmarker => build_thread_marker($bug->id, $user->id, !$bug->lastdiffed), }; @@ -410,6 +418,8 @@ $email->content_type_set($parts[0]->content_type); } else { $email->content_type_set('multipart/alternative'); + # Some mail clients need same encoding for each part, even empty ones. + $email->charset_set('UTF-8') if Bugzilla->params->{'utf8'}; } $email->parts_set(\@parts); return $email; @@ -437,7 +447,8 @@ 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}); @@ -454,18 +465,43 @@ } } - 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 { my $bug = shift; my @fields = @{ Bugzilla->fields({obsolete => 0, in_new_bugmail => 1}) }; my @diffs; + my $params = Bugzilla->params; foreach my $field (@fields) { my $name = $field->name; my $value = $bug->$name; + next if !$field->is_visible_on_bug($bug) + || ($name eq 'classification' && !$params->{'useclassification'}) + || ($name eq 'status_whiteboard' && !$params->{'usestatuswhiteboard'}) + || ($name eq 'qa_contact' && !$params->{'useqacontact'}) + || ($name eq 'target_milestone' && !$params->{'usetargetmilestone'}); + if (ref $value eq 'ARRAY') { $value = join(', ', @$value); } -- To view, visit https://gerrit.wikimedia.org/r/98032 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: If96219d81b5b05e6513d6c95f524d11c4d1e9aaf Gerrit-PatchSet: 2 Gerrit-Project: wikimedia/bugzilla/modifications Gerrit-Branch: master Gerrit-Owner: Aklapper <aklap...@wikimedia.org> Gerrit-Reviewer: Dzahn <dz...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits