summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extensions/BugmailFilter/Extension.pm16
-rw-r--r--extensions/BugmailFilter/lib/Filter.pm7
2 files changed, 22 insertions, 1 deletions
diff --git a/extensions/BugmailFilter/Extension.pm b/extensions/BugmailFilter/Extension.pm
index ebfc1f851..4d4a1938f 100644
--- a/extensions/BugmailFilter/Extension.pm
+++ b/extensions/BugmailFilter/Extension.pm
@@ -235,6 +235,10 @@ sub user_wants_mail {
filter_field => $_->{field_name}, # filter's field_name
field_name => $_->{field_name}, # raw bugzilla field_name
} }
+ grep {
+ # flags are added later
+ $_->{field_name} ne 'flagtypes.name'
+ }
@$diffs
];
@@ -248,6 +252,18 @@ sub user_wants_mail {
}
}
+ # insert fake fields for flags
+ foreach my $diff (@$diffs) {
+ next unless $diff->{field_name} eq 'flagtypes.name';
+ foreach my $change (split(/, /, join(', ', ($diff->{old}, $diff->{new})))) {
+ next unless $change =~ /^(.+)[\?\-+]/;
+ push @$fields, {
+ filter_field => $1,
+ field_name => 'flagtypes.name',
+ };
+ }
+ }
+
# set filter_field on tracking flags to tracking.$type
require Bugzilla::Extension::TrackingFlags::Flag;
my @tracking_flags = Bugzilla->tracking_flags;
diff --git a/extensions/BugmailFilter/lib/Filter.pm b/extensions/BugmailFilter/lib/Filter.pm
index 6246f51d9..d59e19fb7 100644
--- a/extensions/BugmailFilter/lib/Filter.pm
+++ b/extensions/BugmailFilter/lib/Filter.pm
@@ -181,7 +181,12 @@ sub matches {
if (my $field_name = $self->{field_name}) {
if ($args->{field}->{field_name} && substr($field_name, 0, 1) eq '~') {
my $substring = quotemeta(substr($field_name, 1));
- if ($args->{field}->{field_name} !~ /$substring/i) {
+ if ($args->{field}->{filter_field} !~ /$substring/i) {
+ return 0;
+ }
+ }
+ elsif ($field_name eq 'flagtypes.name') {
+ if ($args->{field}->{field_name} ne $field_name) {
return 0;
}
}