summaryrefslogtreecommitdiffstats
path: root/extensions/TrackingFlags
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2013-11-18 20:48:05 +0100
committerDave Lawrence <dlawrence@mozilla.com>2013-11-18 20:48:05 +0100
commita1ca30a6ae868e80d8af50f94638733b6b822958 (patch)
tree1207aa83917706c2df7ae1d4a4893ea0f0df345e /extensions/TrackingFlags
parent3e5fc54202f854e76b139ec71fd78e91029dc7d2 (diff)
downloadbugzilla-a1ca30a6ae868e80d8af50f94638733b6b822958.tar.gz
bugzilla-a1ca30a6ae868e80d8af50f94638733b6b822958.tar.xz
Bug 936241 - Bug.create doesn't allow tracking flags to be set, but Bug.update does
r=glob
Diffstat (limited to 'extensions/TrackingFlags')
-rw-r--r--extensions/TrackingFlags/Extension.pm26
1 files changed, 22 insertions, 4 deletions
diff --git a/extensions/TrackingFlags/Extension.pm b/extensions/TrackingFlags/Extension.pm
index d1cd9eb8e..7d8f8c401 100644
--- a/extensions/TrackingFlags/Extension.pm
+++ b/extensions/TrackingFlags/Extension.pm
@@ -452,10 +452,12 @@ sub _tracking_flags_search_nonchanged {
sub bug_end_of_create {
my ($self, $args) = @_;
- my $bug = $args->{'bug'};
- my $timestamp = $args->{'timestamp'};
- my $params = Bugzilla->input_params;
- my $user = Bugzilla->user;
+ my $bug = $args->{'bug'};
+ my $timestamp = $args->{'timestamp'};
+ my $user = Bugzilla->user;
+
+ my $params = Bugzilla->request_cache->{tracking_flags_create_params};
+ return if !$params;
my $tracking_flags = Bugzilla::Extension::TrackingFlags::Flag->match({
product => $bug->product,
@@ -581,6 +583,22 @@ sub bug_end_of_update {
}
}
+sub bug_end_of_create_validators {
+ my ($self, $args) = @_;
+ my $params = $args->{params};
+
+ # We need to stash away any params that are setting/updating tracking
+ # flags early on. Otherwise set_all or insert_create_data will complain.
+ my @tracking_flags = Bugzilla::Extension::TrackingFlags::Flag->get_all;
+ my $cache = Bugzilla->request_cache->{tracking_flags_create_params} ||= {};
+ foreach my $flag (@tracking_flags) {
+ my $flag_name = $flag->name;
+ if (defined $params->{$flag_name}) {
+ $cache->{$flag_name} = delete $params->{$flag_name};
+ }
+ }
+}
+
sub mailer_before_send {
my ($self, $args) = @_;
my $email = $args->{email};