Merge pull request #19795 from rnaby/class-wc-api-reports-validate_request-removed-unnecessary-else

Removed unnecessary else condition.
This commit is contained in:
Mike Jolley 2018-04-20 11:40:02 +01:00 committed by GitHub
commit 7f4f70fbea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 6 deletions

View File

@ -317,13 +317,14 @@ class WC_API_Reports extends WC_API_Resource {
*/
protected function validate_request( $id = null, $type = null, $context = null ) {
if ( ! current_user_can( 'view_woocommerce_reports' ) ) {
return new WP_Error( 'woocommerce_api_user_cannot_read_report', __( 'You do not have permission to read this report', 'woocommerce' ), array( 'status' => 401 ) );
} else {
if ( current_user_can( 'view_woocommerce_reports' ) ) {
return true;
}
return new WP_Error(
'woocommerce_api_user_cannot_read_report',
__( 'You do not have permission to read this report', 'woocommerce' ),
array( 'status' => 401 )
);
}
}