diff options
author | Matt Tyson <mtyson@redhat.com> | 2016-01-15 15:44:09 +0100 |
---|---|---|
committer | Gervase Markham <gerv@mozilla.org> | 2016-01-15 15:44:09 +0100 |
commit | 38e12dd8a2c0b35391f20b60e9e3e8643c08f404 (patch) | |
tree | 17bc36ed5ff0a19741fc88378fbddc2578936b2b /post_bug.cgi | |
parent | 513b4458b42e7f20ee0e57995c339c2dd6c495e7 (diff) | |
download | bugzilla-38e12dd8a2c0b35391f20b60e9e3e8643c08f404.tar.gz bugzilla-38e12dd8a2c0b35391f20b60e9e3e8643c08f404.tar.xz |
'Bug 1159057: change to create flags as part of bug creation process. r=gerv
Diffstat (limited to 'post_bug.cgi')
-rwxr-xr-x | post_bug.cgi | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/post_bug.cgi b/post_bug.cgi index 78a18e759..a01cd11fb 100755 --- a/post_bug.cgi +++ b/post_bug.cgi @@ -125,6 +125,18 @@ foreach my $field (@multi_selects) { $bug_params{$field->name} = [$cgi->param($field->name)]; } + +my $product = Bugzilla::Product->check($bug_params{'product'}); +my $component_id = Bugzilla::Component->check({ + product => $product, + name => $bug_params{'component'}})->id; + +# Set bug flags. +my (undef, $flag_data) = Bugzilla::Flag->extract_flags_from_cgi($vars, SKIP_REQUESTEE_ON_ERROR,{ + product_id => $product->id, + component_id => $component_id }); +$bug_params{flags} = $flag_data; + my $bug = Bugzilla::Bug->create(\%bug_params); # Get the bug ID back and delete the token used to create this bug. @@ -180,7 +192,8 @@ if ($data_fh || $attach_text) { if ($attachment) { # Set attachment flags. my ($flags, $new_flags) = Bugzilla::Flag->extract_flags_from_cgi( - $bug, $attachment, $vars, SKIP_REQUESTEE_ON_ERROR); + $vars, SKIP_REQUESTEE_ON_ERROR, + { bug => $bug, attachment => $attachment }); $attachment->set_flags($flags, $new_flags); $attachment->update($timestamp); my $comment = $bug->comments->[0]; @@ -193,11 +206,6 @@ if ($data_fh || $attach_text) { } } -# Set bug flags. -my ($flags, $new_flags) = Bugzilla::Flag->extract_flags_from_cgi($bug, undef, $vars, - SKIP_REQUESTEE_ON_ERROR); -$bug->set_flags($flags, $new_flags); -$bug->update($timestamp); $vars->{'id'} = $id; $vars->{'bug'} = $bug; |