Ticket #38341: 38314.6.diff
File 38314.6.diff, 3.5 KB (added by , 8 years ago) |
---|
-
src/wp-admin/includes/class-wp-comments-list-table.php
354 354 submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) ); 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' ); 360 360 submit_button( $title, 'apply', 'delete_all', false ); -
src/wp-admin/includes/class-wp-media-list-table.php
177 177 submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) ); 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 } ?> 183 183 </div> -
src/wp-admin/includes/class-wp-posts-list-table.php
489 489 } 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 } 495 495 ?> -
src/wp-admin/js/edit-comments.js
461 461 updateCountText( 'span.trash-count', trashDiff ); 462 462 } 463 463 464 if ( ( 'trash' === settings.data.comment_status ) && ( 0 === getCount( $( 'span.trash-count' ) ) ) { 465 $( '#delete_all' ).hide(); 466 } 467 468 if ( ( 'spam' === settings.data.comment_status ) && ( 0 === getCount( $( 'span.spam-count' ) ) ) { 469 $( '#delete_all' ).hide(); 470 } 471 464 472 if ( ! isDashboard ) { 465 473 total = totalInput.val() ? parseInt( totalInput.val(), 10 ) : 0; 466 474 if ( $(settings.target).parent().is('span.undo') ) -
tests/phpunit/tests/admin/includesListTable.php
235 235 236 236 $this->assertNotContains( 'id="cat"', $output ); 237 237 } 238 239 /** 240 * @ticket 38341 241 */ 242 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 } 238 252 }