Skip to content

Commit 3045051

Browse files
Coding Standards: Remove redundant conditional in WP_Customize_Manager.
This check would always be true, as `::handle_changeset_trash_request()` returns early a few lines above if `$changeset_post_id` is false. Follow-up to [41667], [48211]. Props justlevine. See #63268. git-svn-id: https://develop.svn.wordpress.org/trunk@60414 602fd350-edb4-49c9-b593-d223f7449a82
1 parent eddc54d commit 3045051

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

src/wp-includes/class-wp-customize-manager.php

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3165,27 +3165,25 @@ public function handle_changeset_trash_request() {
31653165
return;
31663166
}
31673167

3168-
if ( $changeset_post_id ) {
3169-
if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->delete_post, $changeset_post_id ) ) {
3170-
wp_send_json_error(
3171-
array(
3172-
'code' => 'changeset_trash_unauthorized',
3173-
'message' => __( 'Unable to trash changes.' ),
3174-
)
3175-
);
3176-
}
3168+
if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->delete_post, $changeset_post_id ) ) {
3169+
wp_send_json_error(
3170+
array(
3171+
'code' => 'changeset_trash_unauthorized',
3172+
'message' => __( 'Unable to trash changes.' ),
3173+
)
3174+
);
3175+
}
31773176

3178-
$lock_user = (int) wp_check_post_lock( $changeset_post_id );
3177+
$lock_user = (int) wp_check_post_lock( $changeset_post_id );
31793178

3180-
if ( $lock_user && get_current_user_id() !== $lock_user ) {
3181-
wp_send_json_error(
3182-
array(
3183-
'code' => 'changeset_locked',
3184-
'message' => __( 'Changeset is being edited by other user.' ),
3185-
'lockUser' => $this->get_lock_user_data( $lock_user ),
3186-
)
3187-
);
3188-
}
3179+
if ( $lock_user && get_current_user_id() !== $lock_user ) {
3180+
wp_send_json_error(
3181+
array(
3182+
'code' => 'changeset_locked',
3183+
'message' => __( 'Changeset is being edited by other user.' ),
3184+
'lockUser' => $this->get_lock_user_data( $lock_user ),
3185+
)
3186+
);
31893187
}
31903188

31913189
if ( 'trash' === get_post_status( $changeset_post_id ) ) {

0 commit comments

Comments
 (0)