diff --git a/Source/Source.API.php b/Source/Source.API.php index 660a3a7..a23a3ba 100644 --- a/Source/Source.API.php +++ b/Source/Source.API.php @@ -118,7 +118,7 @@ * and save the changes. * @param array Changeset objects */ -function Source_Process_Buglinks( $p_changesets ) { +function Source_Process_Changesets( $p_changesets ) { if ( !is_array( $p_changesets ) ) { return; } @@ -144,9 +144,15 @@ $t_changeset->bugs = array_merge( $t_changeset->bugs, $t_bugs ); } + # Precache information for resolved bugs + bug_cache_array_rows( $t_resolved_bugs ); + # Start resolving issues foreach( $t_resolved_bugs as $t_bug_id => $t_changeset ) { - bug_resolve( $t_bug_id, FIXED, '', '', null, $t_changeset->user_id ); + $t_status = config_get( 'bug_resolved_status_threshold', null, null, bug_get_field( $t_bug_id, 'project_id' ) ); + $t_user_id = $t_changeset->user_id > 0 ? $t_changeset->user_id : null; + + bug_resolve( $t_bug_id, $t_status, '', '', null, $t_user_id ); } } diff --git a/Source/pages/checkin.php b/Source/pages/checkin.php index d9d98b4..0f6b880 100644 --- a/Source/pages/checkin.php +++ b/Source/pages/checkin.php @@ -89,7 +89,7 @@ die( plugin_lang_get( 'invalid_changeset' ) ); } -Source_Process_Buglinks( $t_changesets ); +Source_Process_Changesets( $t_changesets ); # Allow plugins to handle commits afterwards event_signal( 'EVENT_SOURCE_POSTCOMMIT', array( $t_repo, $t_changesets ) ); diff --git a/Source/pages/repo_import_full.php b/Source/pages/repo_import_full.php index 9f6b35c..d6832c9 100644 --- a/Source/pages/repo_import_full.php +++ b/Source/pages/repo_import_full.php @@ -32,7 +32,7 @@ $t_changesets = event_signal( 'EVENT_SOURCE_IMPORT_FULL', array( $t_new_repo ) ); if ( is_array( $t_changesets ) ) { - Source_Process_Buglinks( $t_changesets ); + Source_Process_Changesets( $t_changesets ); $t_new_repo->name = $t_repo->name; $t_new_repo->save(); diff --git a/Source/pages/repo_import_latest.php b/Source/pages/repo_import_latest.php index 8243045..195c05b 100644 --- a/Source/pages/repo_import_latest.php +++ b/Source/pages/repo_import_latest.php @@ -90,7 +90,7 @@ if ( !is_array( $t_changesets ) ) { echo plugin_lang_get( 'import_latest_failed' ), '
'; } else { - Source_Process_Buglinks( $t_changesets ); + Source_Process_Changesets( $t_changesets ); event_signal( 'EVENT_SOURCE_POSTIMPORT', array( $t_repo, $t_changesets ) ); }