@@ -581,7 +581,6 @@ sub insert {
581
581
my ($flags , $new_flags ) = Bugzilla::Flag-> extract_flags_from_cgi(
582
582
$bug , $attachment , $vars , SKIP_REQUESTEE_ON_ERROR);
583
583
$attachment -> set_flags($flags , $new_flags );
584
- $attachment -> update($timestamp );
585
584
586
585
# Insert a comment about the new attachment into the database.
587
586
my $comment = $cgi -> param(' comment' );
@@ -610,6 +609,10 @@ sub insert {
610
609
}
611
610
$bug -> update($timestamp );
612
611
612
+ # We have to update the attachment after updating the bug, to ensure new
613
+ # comments are available.
614
+ $attachment -> update($timestamp );
615
+
613
616
$dbh -> bz_commit_transaction;
614
617
615
618
# Define the variables and functions that will be passed to the UI template.
@@ -755,16 +758,18 @@ sub update {
755
758
# Figure out when the changes were made.
756
759
my $timestamp = $dbh -> selectrow_array(' SELECT LOCALTIMESTAMP(0)' );
757
760
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
+
758
766
if ($can_edit ) {
759
767
my $changes = $attachment -> update($timestamp );
760
768
# If there are changes, we updated delta_ts in the DB. We have to
761
769
# reflect this change in the bug object.
762
770
$bug -> {delta_ts } = $timestamp if scalar (keys %$changes );
763
771
}
764
772
765
- # Commit the comment, if any.
766
- $bug -> update($timestamp );
767
-
768
773
# Commit the transaction now that we are finished updating the database.
769
774
$dbh -> bz_commit_transaction();
770
775
0 commit comments