Skip to content

Commit

Permalink
Address Tags API PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vboctor committed Jan 27, 2018
1 parent 627c8a2 commit 75e5a18
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions core/commands/TagAttachCommand.php
Expand Up @@ -104,7 +104,7 @@ function validate() {
}
} else {
throw new ClientException(
sprintf( "Tag '%s' not found", $t_tag['name'] ),
sprintf( "Tag '%s' not found. Access denied to auto-create tag.", $t_tag['name'] ),
ERROR_INVALID_FIELD_VALUE,
array( 'tags' ) );
}
Expand All @@ -124,13 +124,13 @@ function validate() {
* @returns array Command response
*/
protected function process() {
$t_attached_tag_ids = array();
$t_attached_tags = array();

# Attach tags that already exist
foreach( $this->tagsToAttach as $t_tag_id ) {
if( !tag_bug_is_attached( $t_tag_id, $this->issue_id ) ) {
tag_bug_attach( $t_tag_id, $this->issue_id, $this->user_id );
$t_attached_tag_ids[] = tag_get( $t_tag_id );
$t_attached_tags[] = tag_get( $t_tag_id );
}
}

Expand All @@ -139,12 +139,12 @@ protected function process() {
$t_tag_id = tag_create( $t_tag_name, $this->user_id );
if( !tag_bug_is_attached( $t_tag_id, $this->issue_id ) ) {
tag_bug_attach( $t_tag_id, $this->issue_id, $this->user_id );
$t_attached_tag_ids[] = tag_get( $t_tag_id );
$t_attached_tags[] = tag_get( $t_tag_id );
}
}

if( !empty( $t_attached_tag_ids ) ) {
event_signal( 'EVENT_TAG_ATTACHED', array( $this->issue_id, $t_attached_tag_ids ) );
if( !empty( $t_attached_tags ) ) {
event_signal( 'EVENT_TAG_ATTACHED', array( $this->issue_id, $t_attached_tags ) );
}
}
}
Expand Down

0 comments on commit 75e5a18

Please sign in to comment.