diff options
author | Byron Jones <glob@mozilla.com> | 2014-10-27 04:34:55 +0100 |
---|---|---|
committer | Byron Jones <glob@mozilla.com> | 2014-10-27 04:34:55 +0100 |
commit | 7afb631c9c4893a554f1ecd395f1ffbae3413cb8 (patch) | |
tree | 8b4183ecee7c20bdf79b2a0fe2665c848282ceb1 | |
parent | 883791b3dc130fb3575a07b9936e41af5a04ff46 (diff) | |
download | bugzilla-7afb631c9c4893a554f1ecd395f1ffbae3413cb8.tar.gz bugzilla-7afb631c9c4893a554f1ecd395f1ffbae3413cb8.tar.xz |
Bug 1075281: bugmail filtering not working the way I expect it to
-rw-r--r-- | extensions/BugmailFilter/Extension.pm | 16 | ||||
-rw-r--r-- | extensions/BugmailFilter/lib/Filter.pm | 7 |
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; } } |