diff --git a/extensions/BugmailFilter/Extension.pm b/extensions/BugmailFilter/Extension.pm index a05953336a..8d5d964d1c 100644 --- a/extensions/BugmailFilter/Extension.pm +++ b/extensions/BugmailFilter/Extension.pm @@ -339,8 +339,10 @@ sub _should_drop { $rel_map[8] = !$rel_map[8]; $rel_map[9] = ($relationship & $bit_watching or $relationship & $bit_compwatch); $rel_map[10] = !$rel_map[9]; - $rel_map[11] = $bug->is_mentor($user); - $rel_map[12] = !$rel_map[11]; + if (Bugzilla->has_extension('Review')) { + $rel_map[11] = $bug->is_mentor($user); + $rel_map[12] = !$rel_map[11]; + } foreach my $bool (@rel_map) { $bool = $bool ? 1 : 0; } diff --git a/extensions/BugmailFilter/lib/Constants.pm b/extensions/BugmailFilter/lib/Constants.pm index 655cd7fd66..0051d6b371 100644 --- a/extensions/BugmailFilter/lib/Constants.pm +++ b/extensions/BugmailFilter/lib/Constants.pm @@ -67,21 +67,27 @@ use constant IGNORE_FIELDS => qw( use constant FIELD_DESCRIPTION_OVERRIDE => {bug_id => 'Bug Created',}; # relationship / int mappings -# _should_drop() also needs updating when this const is changed +# _should_drop() also needs updating when this is changed -use constant FILTER_RELATIONSHIPS => [ - {name => 'Assignee', value => 1,}, - {name => 'Not Assignee', value => 2,}, - {name => 'Reporter', value => 3,}, - {name => 'Not Reporter', value => 4,}, - {name => 'QA Contact', value => 5,}, - {name => 'Not QA Contact', value => 6,}, - {name => "CC'ed", value => 7,}, - {name => "Not CC'ed", value => 8,}, - {name => 'Watching', value => 9,}, - {name => 'Not Watching', value => 10,}, - {name => 'Mentoring', value => 11,}, - {name => 'Not Mentoring', value => 12,}, -]; +sub FILTER_RELATIONSHIPS() { + state $relations; + return \@$relations if $relations; + my $index = 1; + push @$relations, { name => 'Assignee', value => $index++ }; + push @$relations, { name => 'Not Assignee', value => $index++ }; + push @$relations, { name => 'Reporter', value => $index++ }; + push @$relations, { name => 'Not Reporter', value => $index++ }; + push @$relations, { name => 'QA Contact', value => $index++ }; + push @$relations, { name => 'Not QA Contact', value => $index++ }; + push @$relations, { name => "CC'ed", value => $index++ }; + push @$relations, { name => "Not CC'ed", value => $index++ }; + push @$relations, { name => 'Watching', value => $index++ }; + push @$relations, { name => 'Not Watching', value => $index++ }; + if (Bugzilla->has_extension('Review')) { + push @$relations, { name => 'Mentoring', value => $index++ }; + push @$relations, { name => 'Not Mentoring', value => $index++ }; + } + return \@$relations; +} 1;