diff --git a/Source/Source.API.php b/Source/Source.API.php index d3812bd..d5a1b4a 100644 --- a/Source/Source.API.php +++ b/Source/Source.API.php @@ -460,7 +460,7 @@ /** * Update changeset relations to affected bugs. */ - function save_bugs() { + function save_bugs( $p_user_id=null ) { $t_bug_table = plugin_table( 'bug', 'Source' ); $t_bugs_added = array_diff( $this->bugs, $this->__bugs ); @@ -468,6 +468,8 @@ $this->load_repo(); + $t_user_id = ( is_null( $p_user_id ) ? $this->user_id : (int)$p_user_id ); + if ( count( $t_bugs_deleted ) ) { $t_bugs_deleted_str = join( ',', $t_bugs_deleted ); diff --git a/Source/pages/attach.php b/Source/pages/attach.php index 215910b..f014a3d 100644 --- a/Source/pages/attach.php +++ b/Source/pages/attach.php @@ -20,6 +20,8 @@ $t_changeset = SourceChangeset::load( $f_changeset_id ); $t_changeset->load_bugs(); +$t_user_id = auth_get_current_user_id(); + $t_bug_ids = split( ',', $f_bug_ids ); foreach( $t_bug_ids as $t_bug_id ) { $t_bug_id = (int) $t_bug_id; @@ -33,7 +35,7 @@ } } -$t_changeset->save_bugs(); +$t_changeset->save_bugs( $t_user_id ); form_security_purge( 'plugin_Source_attach' ); print_successful_redirect( plugin_page( 'view', true ) . '&id=' . $t_changeset->id );