Changeset 40297
- Timestamp:
- 03/17/2017 04:53:08 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-comments-list-table.php
r39669 r40297 355 355 } 356 356 357 if ( ( 'spam' === $comment_status || 'trash' === $comment_status ) && current_user_can( 'moderate_comments' ) ) {357 if ( ( 'spam' === $comment_status || 'trash' === $comment_status ) && current_user_can( 'moderate_comments' ) && $this->has_items() ) { 358 358 wp_nonce_field( 'bulk-destroy', '_destroy_nonce' ); 359 359 $title = ( 'spam' === $comment_status ) ? esc_attr__( 'Empty Spam' ) : esc_attr__( 'Empty Trash' ); -
trunk/src/wp-admin/includes/class-wp-media-list-table.php
r39917 r40297 178 178 } 179 179 180 if ( $this->is_trash && current_user_can( 'edit_others_posts' ) ) {180 if ( $this->is_trash && current_user_can( 'edit_others_posts' ) && $this->has_items() ) { 181 181 submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false ); 182 182 } ?> -
trunk/src/wp-admin/includes/class-wp-posts-list-table.php
r39956 r40297 490 490 } 491 491 492 if ( $this->is_trash && current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_others_posts ) ) {492 if ( $this->is_trash && current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_others_posts ) && $this->has_items() ) { 493 493 submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false ); 494 494 } -
trunk/src/wp-admin/js/edit-comments.js
r37303 r40297 460 460 if ( trashDiff ) { 461 461 updateCountText( 'span.trash-count', trashDiff ); 462 } 463 464 if ( 465 ( ( 'trash' === settings.data.comment_status ) && !getCount( $( 'span.trash-count' ) ) ) || 466 ( ( 'spam' === settings.data.comment_status ) && !getCount( $( 'span.spam-count' ) ) ) 467 ) { 468 $( '#delete_all' ).hide(); 462 469 } 463 470 -
trunk/tests/phpunit/tests/admin/includesListTable.php
r39481 r40297 236 236 $this->assertNotContains( 'id="cat"', $output ); 237 237 } 238 239 /** 240 * @ticket 38341 241 */ 242 public function test_empty_trash_button_should_not_be_shown_if_there_are_no_posts() { 243 // Set post type to a non-existent one. 244 $this->table->screen->post_type = 'foo'; 245 246 ob_start(); 247 $this->table->extra_tablenav( 'top' ); 248 $output = ob_get_clean(); 249 250 $this->assertNotContains( 'id="delete_all"', $output ); 251 } 252 253 /** 254 * @ticket 38341 255 */ 256 public function test_empty_trash_button_should_not_be_shown_if_there_are_no_comments() { 257 $table = _get_list_table( 'WP_Comments_List_Table', array( 'screen' => 'edit-comments' ) ); 258 259 ob_start(); 260 $table->extra_tablenav( 'top' ); 261 $output = ob_get_clean(); 262 263 $this->assertNotContains( 'id="delete_all"', $output ); 264 } 238 265 }
Note: See TracChangeset
for help on using the changeset viewer.