Commit 940d3fa9 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 42d5e455
......@@ -540,7 +540,6 @@ sub insert {
my ($flags, $new_flags) = Bugzilla::Flag->extract_flags_from_cgi(
$bug, $attachment, $vars, SKIP_REQUESTEE_ON_ERROR);
$attachment->set_flags($flags, $new_flags);
$attachment->update($timestamp);
# Insert a comment about the new attachment into the database.
my $comment = $cgi->param('comment');
......@@ -554,7 +553,8 @@ sub insert {
if ($cgi->param('takebug') && $user->in_group('editbugs', $bug->product_id)) {
# When taking a bug, we have to follow the workflow.
my $bug_status = $cgi->param('bug_status') || '';
($bug_status) = grep {$_->name eq $bug_status} @{$bug->status->can_change_to};
($bug_status) = grep { $_->name eq $bug_status }
@{ $bug->status->can_change_to };
if ($bug_status && $bug_status->is_open
&& ($bug_status->name ne 'UNCONFIRMED'
......@@ -571,6 +571,10 @@ sub insert {
$bug->add_cc($user) if $cgi->param('addselfcc');
$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;
# Define the variables and functions that will be passed to the UI template.
......@@ -600,11 +604,11 @@ sub edit {
my $bugattachments =
Bugzilla::Attachment->get_attachments_by_bug($attachment->bug);
my $any_flags_requesteeble =
grep { $_->is_requestable && $_->is_requesteeble } @{$attachment->flag_types};
my $any_flags_requesteeble = grep { $_->is_requestable && $_->is_requesteeble }
@{ $attachment->flag_types };
# Useful in case a flagtype is no longer requestable but a requestee
# has been set before we turned off that bit.
$any_flags_requesteeble ||= grep { $_->requestee_id } @{$attachment->flags};
$any_flags_requesteeble ||= grep { $_->requestee_id } @{ $attachment->flags };
$vars->{'any_flags_requesteeble'} = $any_flags_requesteeble;
$vars->{'attachment'} = $attachment;
$vars->{'attachments'} = $bugattachments;
......@@ -715,6 +719,11 @@ sub update {
# Figure out when the changes were made.
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) {
my $changes = $attachment->update($timestamp);
# If there are changes, we updated delta_ts in the DB. We have to
......@@ -722,9 +731,6 @@ sub update {
$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.
$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