Skip to content

Commit

Permalink
Fix relationship formating and localization in REST
Browse files Browse the repository at this point in the history
- Issue type name shouldn’t be localized.
- Add issue type label with localized name.
- Relationships where issue is destination were not formatted correctly.

Fixes #23898, 23899
  • Loading branch information
vboctor committed Jan 28, 2018
1 parent 2f88f94 commit 843c450
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions api/soap/mc_issue_api.php
Expand Up @@ -544,7 +544,14 @@ function mci_issue_get_relationships( $p_issue_id, $p_user_id ) {
$t_reltype = array();
$t_relationship['id'] = (int)$t_relship_row->id;
$t_reltype['id'] = (int)$t_relship_row->type;
$t_reltype['name'] = relationship_get_description_src_side( $t_relship_row->type );

if( ApiObjectFactory::$soap ) {
$t_reltype['name'] = relationship_get_description_src_side( $t_relship_row->type );
} else {
$t_reltype['name'] = relationship_get_name_for_api( $t_relship_row->type );
$t_reltype['label'] = relationship_get_description_src_side( $t_relship_row->type );
}

$t_relationship['type'] = $t_reltype;

if( ApiObjectFactory::$soap ) {
Expand All @@ -563,10 +570,25 @@ function mci_issue_get_relationships( $p_issue_id, $p_user_id ) {
$t_relationship = array();
$t_relationship['id'] = (int)$t_relship_row->id;
$t_reltype = array();
$t_reltype['id'] = (int)relationship_get_complementary_type( $t_relship_row->type );
$t_reltype['name'] = relationship_get_description_dest_side( $t_relship_row->type );
$t_complementary_type_id = (int)relationship_get_complementary_type( $t_relship_row->type );
$t_reltype['id'] = $t_complementary_type_id;

if( ApiObjectFactory::$soap ) {
$t_reltype['name'] = relationship_get_description_dest_side( $t_relship_row->type );
} else {
$t_reltype['name'] = relationship_get_name_for_api( $t_complementary_type_id );
$t_reltype['label'] = relationship_get_description_dest_side( $t_relship_row->type );
}

$t_relationship['type'] = $t_reltype;
$t_relationship['target_id'] = (int)$t_relship_row->src_bug_id;
$t_related_issue_id = (int)$t_relship_row->src_bug_id;

if( ApiObjectFactory::$soap ) {
$t_relationship['target_id'] = $t_related_issue_id;
} else {
$t_relationship['issue'] = mci_related_issue_as_array_by_id( $t_related_issue_id );
}

$t_relationships[] = $t_relationship;
}
}
Expand Down

0 comments on commit 843c450

Please sign in to comment.