summaryrefslogtreecommitdiffstats
path: root/extensions/TrackingFlags/Extension.pm
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@mozilla.com>2015-06-16 22:04:01 +0200
committerDylan William Hardison <dylan@hardison.net>2015-06-16 22:04:01 +0200
commit379d122f297cee76752388892223bcd3f1df0235 (patch)
tree85332c4f77d06d9cc457c6ea3d5a1bfd3a21059e /extensions/TrackingFlags/Extension.pm
parentca30cabb0b4b3085d85edc54171f21d2673c8b6c (diff)
downloadbugzilla-379d122f297cee76752388892223bcd3f1df0235.tar.gz
bugzilla-379d122f297cee76752388892223bcd3f1df0235.tar.xz
Bug 825946: tracking flags should be cleared when a bug is moved to a product/component where they are not valid
Diffstat (limited to 'extensions/TrackingFlags/Extension.pm')
-rw-r--r--extensions/TrackingFlags/Extension.pm17
1 files changed, 17 insertions, 0 deletions
diff --git a/extensions/TrackingFlags/Extension.pm b/extensions/TrackingFlags/Extension.pm
index 0c70c54f6..33792dc38 100644
--- a/extensions/TrackingFlags/Extension.pm
+++ b/extensions/TrackingFlags/Extension.pm
@@ -26,6 +26,7 @@ use Bugzilla::Install::Filesystem;
use Bugzilla::Product;
use JSON;
+use List::MoreUtils qw(none);
our $VERSION = '1';
@@ -637,12 +638,28 @@ sub bug_end_of_update {
is_active => 1,
});
+ my $product_id = $bug->product_id;
+ my $component_id = $bug->component_id;
+ my $is_visible = sub {
+ $_->product_id == $product_id && (!$_->component_id || $_->component_id == $component_id);
+ };
+
my (@flag_changes);
foreach my $flag (@$tracking_flags) {
my $flag_name = $flag->name;
my $new_value = $bug->$flag_name;
my $old_value = $old_bug->$flag_name;
+ if ($flag->bug_flag->id) {
+ my $visibility = $flag->visibility;
+ if (none { $is_visible->() } @$visibility) {
+ push(@flag_changes, { flag => $flag,
+ added => '---',
+ removed => $new_value });
+ next;
+ }
+ }
+
if ($new_value ne $old_value) {
# Do not allow if the user cannot set the old value or the new value
if (!$flag->can_set_value($new_value)) {