Skip to content
This repository was archived by the owner on Dec 27, 2022. It is now read-only.

Commit f5afffa

Browse files
committed
Make sure publish_customize_snapshots cap is checked
1 parent f7868e5 commit f5afffa

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

php/class-post-type.php

-1
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,6 @@ public function filter_user_has_cap( $allcaps, $caps ) {
588588
if ( ! current_user_can( 'customize_publish' ) || empty( $allcaps['customize_publish'] ) ) {
589589
$allcaps[ $post_type_obj->cap->publish_posts ] = false;
590590
}
591-
592591
if ( ! current_user_can( 'edit_others_posts' ) ) {
593592
$allcaps[ $post_type_obj->cap->edit_others_posts ] = false;
594593
}

tests/php/test-class-ajax-customize-snapshot-manager.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ function test_ajax_update_snapshot_schedule() {
430430
$setting_key = 'anyonecanedit';
431431
$tomorrow = date( 'Y-m-d H:i:s', time() + 86400 );
432432
$this->set_current_user( 'administrator' );
433+
$this->assertTrue( current_user_can( 'publish_customize_snapshots' ) );
433434
$this->set_input_vars( array(
434435
'action' => Customize_Snapshot_Manager::AJAX_ACTION,
435436
'nonce' => wp_create_nonce( Customize_Snapshot_Manager::AJAX_ACTION ),
@@ -483,12 +484,12 @@ function test_ajax_update_snapshot_ok_for_draft_and_pending_but_not_future() {
483484
}, 10, 3 );
484485
$tomorrow = date( 'Y-m-d H:i:s', time() + 86400 );
485486
$this->set_current_user( 'contributor' );
487+
$this->assertFalse( current_user_can( 'publish_customize_snapshots' ) );
486488
$post_vars = array(
487489
'action' => Customize_Snapshot_Manager::AJAX_ACTION,
488490
'nonce' => wp_create_nonce( Customize_Snapshot_Manager::AJAX_ACTION ),
489491
'customize_snapshot_uuid' => self::UUID,
490492
'customized' => wp_json_encode( array( $setting_key => 'Hello' ) ),
491-
'status' => 'draft',
492493
'publish_date' => $tomorrow, // Tomorrow.
493494
);
494495

@@ -497,7 +498,7 @@ function test_ajax_update_snapshot_ok_for_draft_and_pending_but_not_future() {
497498
$this->add_setting();
498499

499500
// Draft pass.
500-
$post_vars['status'] = 'pending';
501+
$post_vars['status'] = 'draft';
501502
$this->set_input_vars( $post_vars );
502503
$this->make_ajax_call( Customize_Snapshot_Manager::AJAX_ACTION );
503504
$response = json_decode( $this->_last_response, true );

0 commit comments

Comments
 (0)