From 2f3b5dd7df3e131af6aef3cd5ccf7e8523c1780e Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Tue, 8 Jul 2014 16:40:14 +0800 Subject: Bug 990980: create an extension for server-side filtering of bugmail --- Bugzilla/BugMail.pm | 6 ++++++ Bugzilla/User.pm | 14 +++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'Bugzilla') diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm index 50d13439c..9980535ce 100644 --- a/Bugzilla/BugMail.pm +++ b/Bugzilla/BugMail.pm @@ -407,6 +407,12 @@ sub sendMail { my @changedfields = uniq map { $_->{field_desc} } @display_diffs; my @changedfieldnames = uniq map { $_->{field_name} } @display_diffs; + # BMO: Add a field to indicate when a comment was added + if (grep($_->type != CMT_ATTACHMENT_CREATED, @send_comments)) { + push(@changedfields, 'Comment Created'); + push(@changedfieldnames, 'comment'); + } + # Add attachments.created to changedfields if one or more # comments contain information about a new attachment if (grep($_->type == CMT_ATTACHMENT_CREATED, @send_comments)) { diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index 8526c42d7..259a7ea90 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -1834,7 +1834,19 @@ sub wants_bug_mail { if ($wants_mail && $bug->bug_status eq 'UNCONFIRMED') { $wants_mail &= $self->wants_mail([EVT_UNCONFIRMED], $relationship); } - + + # BMO: add a hook to allow custom bugmail filtering + Bugzilla::Hook::process("user_wants_mail", { + user => $self, + wants_mail => \$wants_mail, + bug => $bug, + relationship => $relationship, + fieldDiffs => $fieldDiffs, + comments => $comments, + dep_mail => $dep_mail, + changer => $changer, + }); + return $wants_mail; } -- cgit v1.2.3-24-g4f1b