Commit bad9ac71 authored by Byron Jones's avatar Byron Jones

Bug 1082887: comments made when setting a flag from the attachment details page…

Bug 1082887: comments made when setting a flag from the attachment details page are not included in the "flag updated" email r=dkl,a=glob
parent 8e3d2def
...@@ -549,7 +549,6 @@ sub insert { ...@@ -549,7 +549,6 @@ sub insert {
my ($flags, $new_flags) = Bugzilla::Flag->extract_flags_from_cgi( my ($flags, $new_flags) = Bugzilla::Flag->extract_flags_from_cgi(
$bug, $attachment, $vars, SKIP_REQUESTEE_ON_ERROR); $bug, $attachment, $vars, SKIP_REQUESTEE_ON_ERROR);
$attachment->set_flags($flags, $new_flags); $attachment->set_flags($flags, $new_flags);
$attachment->update($timestamp);
# Insert a comment about the new attachment into the database. # Insert a comment about the new attachment into the database.
my $comment = $cgi->param('comment'); my $comment = $cgi->param('comment');
...@@ -580,6 +579,10 @@ sub insert { ...@@ -580,6 +579,10 @@ sub insert {
$bug->add_cc($user) if $cgi->param('addselfcc'); $bug->add_cc($user) if $cgi->param('addselfcc');
$bug->update($timestamp); $bug->update($timestamp);
# We have to update the attachment after updating the bug, to ensure new
# comments are available.
$attachment->update($timestamp);
$dbh->bz_commit_transaction; $dbh->bz_commit_transaction;
# Define the variables and functions that will be passed to the UI template. # Define the variables and functions that will be passed to the UI template.
...@@ -702,6 +705,11 @@ sub update { ...@@ -702,6 +705,11 @@ sub update {
# Figure out when the changes were made. # Figure out when the changes were made.
my $timestamp = $dbh->selectrow_array('SELECT LOCALTIMESTAMP(0)'); my $timestamp = $dbh->selectrow_array('SELECT LOCALTIMESTAMP(0)');
# Commit the comment, if any.
# This has to happen before updating the attachment, to ensure new comments
# are available to $attachment->update.
$bug->update($timestamp);
if ($can_edit) { if ($can_edit) {
my $changes = $attachment->update($timestamp); my $changes = $attachment->update($timestamp);
# If there are changes, we updated delta_ts in the DB. We have to # If there are changes, we updated delta_ts in the DB. We have to
...@@ -709,9 +717,6 @@ sub update { ...@@ -709,9 +717,6 @@ sub update {
$bug->{delta_ts} = $timestamp if scalar(keys %$changes); $bug->{delta_ts} = $timestamp if scalar(keys %$changes);
} }
# Commit the comment, if any.
$bug->update($timestamp);
# Commit the transaction now that we are finished updating the database. # Commit the transaction now that we are finished updating the database.
$dbh->bz_commit_transaction(); $dbh->bz_commit_transaction();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment