From 89b5f4c5cbf144f5248174da905daf1d14831fbb Mon Sep 17 00:00:00 2001 From: Victor Boctor Date: Thu, 5 Dec 2019 23:11:18 -0800 Subject: [PATCH] Avoid blank notes on group resolve/close actions Fixes #26150 Signed-off-by: Victor Boctor --- core/bug_api.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/core/bug_api.php b/core/bug_api.php index 3b2724eb85..01008ad83c 100644 --- a/core/bug_api.php +++ b/core/bug_api.php @@ -1905,8 +1905,10 @@ function bug_close( $p_bug_id, $p_bugnote_text = '', $p_bugnote_private = false, # Add bugnote if supplied ignore a false return # Moved bugnote_add before bug_set_field calls in case time_tracking_no_note is off. # Error condition stopped execution but status had already been changed - $t_bugnote_id = bugnote_add( $p_bug_id, $p_bugnote_text, $p_time_tracking, $p_bugnote_private, 0, '', null, false ); - bugnote_process_mentions( $p_bug_id, $t_bugnote_id, $p_bugnote_text ); + if( !is_blank( $p_bugnote_text ) || $p_time_tracking != '0:00' ) { + $t_bugnote_id = bugnote_add( $p_bug_id, $p_bugnote_text, $p_time_tracking, $p_bugnote_private, 0, '', null, false ); + bugnote_process_mentions( $p_bug_id, $t_bugnote_id, $p_bugnote_text ); + } bug_set_field( $p_bug_id, 'status', config_get( 'bug_closed_status_threshold' ) ); @@ -1936,8 +1938,10 @@ function bug_resolve( $p_bug_id, $p_resolution, $p_fixed_in_version = '', $p_bug # Add bugnote if supplied # Moved bugnote_add before bug_set_field calls in case time_tracking_no_note is off. # Error condition stopped execution but status had already been changed - $t_bugnote_id = bugnote_add( $p_bug_id, $p_bugnote_text, $p_time_tracking, $p_bugnote_private, 0, '', null, false ); - bugnote_process_mentions( $p_bug_id, $t_bugnote_id, $p_bugnote_text ); + if( !is_blank( $p_bugnote_text ) || $p_time_tracking != '0:00' ) { + $t_bugnote_id = bugnote_add( $p_bug_id, $p_bugnote_text, $p_time_tracking, $p_bugnote_private, 0, '', null, false ); + bugnote_process_mentions( $p_bug_id, $t_bugnote_id, $p_bugnote_text ); + } $t_duplicate = !is_blank( $p_duplicate_id ) && ( $p_duplicate_id != 0 ); if( $t_duplicate ) { @@ -2005,8 +2009,10 @@ function bug_reopen( $p_bug_id, $p_bugnote_text = '', $p_time_tracking = '0:00', # Add bugnote if supplied # Moved bugnote_add before bug_set_field calls in case time_tracking_no_note is off. # Error condition stopped execution but status had already been changed - $t_bugnote_id = bugnote_add( $p_bug_id, $p_bugnote_text, $p_time_tracking, $p_bugnote_private, 0, '', null, false ); - bugnote_process_mentions( $p_bug_id, $t_bugnote_id, $p_bugnote_text ); + if( !is_blank( $p_bugnote_text ) || $p_time_tracking != '0:00' ) { + $t_bugnote_id = bugnote_add( $p_bug_id, $p_bugnote_text, $p_time_tracking, $p_bugnote_private, 0, '', null, false ); + bugnote_process_mentions( $p_bug_id, $t_bugnote_id, $p_bugnote_text ); + } bug_set_field( $p_bug_id, 'status', config_get( 'bug_reopen_status' ) ); bug_set_field( $p_bug_id, 'resolution', config_get( 'bug_reopen_resolution' ) );