summaryrefslogtreecommitdiffstats
path: root/extensions/TrackingFlags
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2013-10-15 00:00:54 +0200
committerDave Lawrence <dlawrence@mozilla.com>2013-10-15 00:00:54 +0200
commita95ef3c5ad80875e4cca9987bab78e9e8a3dbe42 (patch)
tree79a97da7eeacb072f85c3140ad07dcdf09868bd3 /extensions/TrackingFlags
parent3eabf868b703bda6547c2693ee45d7bc0b19ae74 (diff)
downloadbugzilla-a95ef3c5ad80875e4cca9987bab78e9e8a3dbe42.tar.gz
bugzilla-a95ef3c5ad80875e4cca9987bab78e9e8a3dbe42.tar.xz
Bug 926118 - tracking flags are being cleared when making a change to a bug using the webservice api after tracking flag migration
r=glob
Diffstat (limited to 'extensions/TrackingFlags')
-rw-r--r--extensions/TrackingFlags/Extension.pm35
1 files changed, 27 insertions, 8 deletions
diff --git a/extensions/TrackingFlags/Extension.pm b/extensions/TrackingFlags/Extension.pm
index 84250859c..a997f44ed 100644
--- a/extensions/TrackingFlags/Extension.pm
+++ b/extensions/TrackingFlags/Extension.pm
@@ -476,13 +476,32 @@ sub bug_end_of_create {
}
}
+sub object_end_of_set_all {
+ my ($self, $args) = @_;
+ my $object = $args->{object};
+ my $params = Bugzilla->input_params;
+
+ return unless $object->isa('Bugzilla::Bug');
+
+ # Do not filter by product/component as we may be changing those
+ my $tracking_flags = Bugzilla::Extension::TrackingFlags::Flag->match({
+ bug_id => $object->id,
+ is_active => 1,
+ });
+
+ foreach my $flag (@$tracking_flags) {
+ my $flag_name = $flag->name;
+ if (defined $params->{$flag_name}) {
+ $object->{$flag_name} = $params->{$flag_name};
+ }
+ }
+}
+
sub bug_end_of_update {
my ($self, $args) = @_;
- my $bug = $args->{'bug'};
- my $timestamp = $args->{'timestamp'};
- my $changes = $args->{'changes'};
- my $params = Bugzilla->input_params;
- my $user = Bugzilla->user;
+ my ($bug, $old_bug, $timestamp, $changes)
+ = @$args{qw(bug old_bug timestamp changes)};
+ my $user = Bugzilla->user;
# Do not filter by product/component as we may be changing those
my $tracking_flags = Bugzilla::Extension::TrackingFlags::Flag->match({
@@ -492,9 +511,9 @@ sub bug_end_of_update {
my (@flag_changes);
foreach my $flag (@$tracking_flags) {
- next if !exists $params->{$flag->name};
- my $new_value = $params->{$flag->name};
- my $old_value = $flag->bug_flag->value;
+ my $flag_name = $flag->name;
+ my $new_value = $bug->$flag_name;
+ my $old_value = $old_bug->$flag_name;
next if $new_value eq $old_value;