Skip to content

Commit

Permalink
Validate issue note type field
Browse files Browse the repository at this point in the history
  • Loading branch information
vboctor committed Jan 10, 2018
1 parent cf5df80 commit 046dcb6
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions core/commands/IssueNoteAddCommand.php
Expand Up @@ -101,6 +101,20 @@ function __construct( array $p_data ) {
* Validate the data.
*/
function validate() {
# Validate issue note type
switch( $this->payload( 'type', 'note' ) ) {
case 'note':
case 'timelog':
break;
case 'reminder': # isn't supported by this command.
default:
throw new ClientException(
sprintf( "Invalid value '%s' for 'type'.", $t_type ),
ERROR_INVALID_FIELD_VALUE,
array( 'type' )
);
}

$t_issue_id = helper_parse_issue_id( $this->query( 'issue_id' ) );

$this->issue = bug_get( $t_issue_id, true );
Expand Down

0 comments on commit 046dcb6

Please sign in to comment.