Skip to content

Commit aa74918

Browse files
committed
Bug 1082887: comments made when setting a flag from the attachment details page are not included in the "flag updated" email
1 parent e8a33a1 commit aa74918

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

attachment.cgi

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,6 @@ sub insert {
581581
my ($flags, $new_flags) = Bugzilla::Flag->extract_flags_from_cgi(
582582
$bug, $attachment, $vars, SKIP_REQUESTEE_ON_ERROR);
583583
$attachment->set_flags($flags, $new_flags);
584-
$attachment->update($timestamp);
585584

586585
# Insert a comment about the new attachment into the database.
587586
my $comment = $cgi->param('comment');
@@ -610,6 +609,10 @@ sub insert {
610609
}
611610
$bug->update($timestamp);
612611

612+
# We have to update the attachment after updating the bug, to ensure new
613+
# comments are available.
614+
$attachment->update($timestamp);
615+
613616
$dbh->bz_commit_transaction;
614617

615618
# Define the variables and functions that will be passed to the UI template.
@@ -755,16 +758,18 @@ sub update {
755758
# Figure out when the changes were made.
756759
my $timestamp = $dbh->selectrow_array('SELECT LOCALTIMESTAMP(0)');
757760

761+
# Commit the comment, if any.
762+
# This has to happen before updating the attachment, to ensure new comments
763+
# are available to $attachment->update.
764+
$bug->update($timestamp);
765+
758766
if ($can_edit) {
759767
my $changes = $attachment->update($timestamp);
760768
# If there are changes, we updated delta_ts in the DB. We have to
761769
# reflect this change in the bug object.
762770
$bug->{delta_ts} = $timestamp if scalar(keys %$changes);
763771
}
764772

765-
# Commit the comment, if any.
766-
$bug->update($timestamp);
767-
768773
# Commit the transaction now that we are finished updating the database.
769774
$dbh->bz_commit_transaction();
770775

0 commit comments

Comments
 (0)