summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Bugzilla/BugMail.pm12
-rw-r--r--extensions/TagNewUsers/Extension.pm22
2 files changed, 32 insertions, 2 deletions
diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm
index 60ff45e38..efbba5215 100644
--- a/Bugzilla/BugMail.pm
+++ b/Bugzilla/BugMail.pm
@@ -130,7 +130,7 @@ sub Send {
my $comments = $bug->comments({ after => $start, to => $end });
# Skip empty comments.
@$comments = grep { $_->type || $_->body =~ /\S/ } @$comments;
-
+
###########################################################################
# Start of email filtering code
###########################################################################
@@ -361,6 +361,14 @@ sub sendMail {
push(@watchingrel, 'None') unless @watchingrel;
push @watchingrel, map { user_id_to_login($_) } @$watchingRef;
+ my @changedfields = uniq map { $_->{field_name} } @display_diffs;
+
+ # Add Attachment Created to changedfields if one or more
+ # comments contain information about a new attachment
+ if (grep($_->type == CMT_ATTACHMENT_CREATED, @send_comments)) {
+ push(@changedfields, 'Attachment Created');
+ }
+
my $vars = {
date => $date,
to_user => $user,
@@ -371,7 +379,7 @@ sub sendMail {
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),
};
diff --git a/extensions/TagNewUsers/Extension.pm b/extensions/TagNewUsers/Extension.pm
index d71c4ea20..4b78c7bc0 100644
--- a/extensions/TagNewUsers/Extension.pm
+++ b/extensions/TagNewUsers/Extension.pm
@@ -224,6 +224,28 @@ sub _user_is_new {
|| ($user->{creation_age} <= PROFILE_AGE);
}
+sub mailer_before_send {
+ my ($self, $args) = @_;
+ my $email = $args->{email};
+
+ my ($bug_id) = ($email->header('Subject') =~ /^[^\d]+(\d+)/);
+ my $changer_login = $email->header('X-Bugzilla-Who');
+ my $changed_fields = $email->header('X-Bugzilla-Changed-Fields');
+
+ if ($bug_id
+ && $changer_login
+ && $changed_fields =~ /Attachment Created/)
+ {
+ my $changer = Bugzilla::User->new({ name => $changer_login });
+ if ($changer
+ && $changer->first_patch_bug_id
+ && $changer->first_patch_bug_id == $bug_id)
+ {
+ $email->header_set('X-Bugzilla-FirstPatch' => $bug_id);
+ }
+ }
+}
+
sub webservice_user_get {
my ($self, $args) = @_;
my ($webservice, $params, $users) = @$args{qw(webservice params users)};