From 2fdfa60f167cbbee507351fba19c8e01880d9ae6 Mon Sep 17 00:00:00 2001 From: Dave Lawrence Date: Wed, 25 Jan 2012 14:47:08 -0500 Subject: Bug 719526 - Add an extra mail header to messages containing a link to a first patch r=glob --- extensions/TagNewUsers/Extension.pm | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'extensions') 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)}; -- cgit v1.2.3-24-g4f1b