aboutsummaryrefslogtreecommitdiffstats
path: root/post_bug.cgi
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2006-07-25 06:22:53 +0000
committerlpsolit%gmail.com <>2006-07-25 06:22:53 +0000
commit2904ac3261ff9bb59e29b74d55d4ada294986ffe (patch)
treec3c5b3a99f23f76502eac1e652044a550ba19371 /post_bug.cgi
parentbea873a66d06670af744b29d9e8d357ae3b5ceed (diff)
downloadbugs-2904ac3261ff9bb59e29b74d55d4ada294986ffe.tar
bugs-2904ac3261ff9bb59e29b74d55d4ada294986ffe.tar.gz
bugs-2904ac3261ff9bb59e29b74d55d4ada294986ffe.tar.bz2
bugs-2904ac3261ff9bb59e29b74d55d4ada294986ffe.tar.xz
bugs-2904ac3261ff9bb59e29b74d55d4ada294986ffe.zip
Bug 174039: Set flags on bug entry - Patch by Frédéric Buclin <LpSolit@gmail.com> r=wurblzap r=myk a=myk
Diffstat (limited to 'post_bug.cgi')
-rwxr-xr-xpost_bug.cgi25
1 files changed, 23 insertions, 2 deletions
diff --git a/post_bug.cgi b/post_bug.cgi
index 083f577ac..6fb054c9f 100755
--- a/post_bug.cgi
+++ b/post_bug.cgi
@@ -536,11 +536,13 @@ $dbh->do("UPDATE bugs SET creation_ts = ? WHERE bug_id = ?",
$dbh->bz_unlock_tables();
+my $bug = new Bugzilla::Bug($id, $user->id);
+
# Add an attachment if requested.
if (defined($cgi->upload('data')) || $cgi->param('attachurl')) {
$cgi->param('isprivate', $cgi->param('commentprivacy'));
Bugzilla::Attachment->insert_attachment_for_bug(!THROW_ERROR,
- $id, $user, $timestamp,
+ $bug, $user, $timestamp,
\$vars)
|| ($vars->{'message'} = 'attachment_creation_failed');
@@ -551,11 +553,30 @@ if (defined($cgi->upload('data')) || $cgi->param('attachurl')) {
};
}
+# Add flags, if any. To avoid dying if something goes wrong
+# while processing flags, we will eval() flag validation.
+# This requires to be in batch mode.
+# XXX: this can go away as soon as flag validation is able to
+# fail without dying.
+Bugzilla->batch(1);
+eval {
+ # Make sure no flags have already been set for this bug.
+ # Impossible? - Well, depends if you hack the URL or not.
+ # Passing a bug ID of 0 will make it complain if it finds one.
+ Bugzilla::Flag::validate($cgi, 0);
+ Bugzilla::FlagType::validate($cgi, $id);
+ Bugzilla::Flag::process($bug, undef, $timestamp, $cgi);
+};
+Bugzilla->batch(0);
+if ($@) {
+ $vars->{'message'} = 'flag_creation_failed';
+ $vars->{'flag_creation_error'} = $@;
+}
+
# Email everyone the details of the new bug
$vars->{'mailrecipients'} = {'changer' => $user->login};
$vars->{'id'} = $id;
-my $bug = new Bugzilla::Bug($id, $user->id);
$vars->{'bug'} = $bug;
ThrowCodeError("bug_error", { bug => $bug }) if $bug->error;