Skip to content

Commit

Permalink
Tag attach group action should trigger event
Browse files Browse the repository at this point in the history
Use command to attach tags which triggers events.

Fixes #27881
  • Loading branch information
vboctor committed Jan 24, 2021
1 parent e7df394 commit f705719
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions bug_actiongroup_attach_tags_inc.php
Expand Up @@ -115,19 +115,21 @@ function action_attach_tags_validate( $p_bug_id ) {
function action_attach_tags_process( $p_bug_id ) {
global $g_action_attach_tags_attach, $g_action_attach_tags_create;

$t_user_id = auth_get_current_user_id();

foreach( $g_action_attach_tags_create as $t_tag_row ) {
$t_tag_row['id'] = tag_create( $t_tag_row['name'], $t_user_id );
$g_action_attach_tags_attach[] = $t_tag_row;
$g_action_attach_tags_attach[] = array( 'name' => $t_tag_row['name'] );
}

$g_action_attach_tags_create = array();

foreach( $g_action_attach_tags_attach as $t_tag_row ) {
if( !tag_bug_is_attached( $t_tag_row['id'], $p_bug_id ) ) {
tag_bug_attach( $t_tag_row['id'], $p_bug_id, $t_user_id );
}
}
$t_data = array(
'query' => array( 'issue_id' => $p_bug_id ),
'payload' => array(
'tags' => $g_action_attach_tags_attach
)
);

$t_command = new TagAttachCommand( $t_data );
$t_command->execute();

return null;
}

0 comments on commit f705719

Please sign in to comment.