From 38e12dd8a2c0b35391f20b60e9e3e8643c08f404 Mon Sep 17 00:00:00 2001 From: Matt Tyson Date: Fri, 15 Jan 2016 14:44:09 +0000 Subject: 'Bug 1159057: change to create flags as part of bug creation process. r=gerv --- post_bug.cgi | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'post_bug.cgi') 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; -- cgit v1.2.3-24-g4f1b