Make WordPress Core

Ticket #38341: 38341.4.diff

File 38341.4.diff, 2.7 KB (added by mathieuhays, 7 years ago)
Line 
1Index: src/wp-admin/includes/class-wp-comments-list-table.php
2===================================================================
3--- src/wp-admin/includes/class-wp-comments-list-table.php      (revision 40293)
4+++ src/wp-admin/includes/class-wp-comments-list-table.php      (working copy)
5@@ -354,7 +354,7 @@
6                        submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
7                }
8 
9-               if ( ( 'spam' === $comment_status || 'trash' === $comment_status ) && current_user_can( 'moderate_comments' ) ) {
10+               if ( ( 'spam' === $comment_status || 'trash' === $comment_status ) && current_user_can( 'moderate_comments' ) && $this->has_items() ) {
11                        wp_nonce_field( 'bulk-destroy', '_destroy_nonce' );
12                        $title = ( 'spam' === $comment_status ) ? esc_attr__( 'Empty Spam' ) : esc_attr__( 'Empty Trash' );
13                        submit_button( $title, 'apply', 'delete_all', false );
14Index: src/wp-admin/includes/class-wp-media-list-table.php
15===================================================================
16--- src/wp-admin/includes/class-wp-media-list-table.php (revision 40293)
17+++ src/wp-admin/includes/class-wp-media-list-table.php (working copy)
18@@ -177,7 +177,7 @@
19                        submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
20                }
21 
22-               if ( $this->is_trash && current_user_can( 'edit_others_posts' ) ) {
23+               if ( $this->is_trash && current_user_can( 'edit_others_posts' ) && $this->has_items() ) {
24                        submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false );
25                } ?>
26                </div>
27Index: src/wp-admin/includes/class-wp-posts-list-table.php
28===================================================================
29--- src/wp-admin/includes/class-wp-posts-list-table.php (revision 40293)
30+++ src/wp-admin/includes/class-wp-posts-list-table.php (working copy)
31@@ -489,7 +489,7 @@
32                        }
33                }
34 
35-               if ( $this->is_trash && current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_others_posts ) ) {
36+               if ( $this->is_trash && current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_others_posts ) && $this->has_items() ) {
37                        submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false );
38                }
39 ?>
40Index: src/wp-admin/js/edit-comments.js
41===================================================================
42--- src/wp-admin/js/edit-comments.js    (revision 40293)
43+++ src/wp-admin/js/edit-comments.js    (working copy)
44@@ -461,6 +461,10 @@
45                        updateCountText( 'span.trash-count', trashDiff );
46                }
47 
48+               
if ( 0 === getCount( $( 'span.trash-count' ) ) ) {

49+                       $( '#delete_all' ).hide();
50+               
}
51+
52                if ( ! isDashboard ) {
53                        total = totalInput.val() ? parseInt( totalInput.val(), 10 ) : 0;
54                        if ( $(settings.target).parent().is('span.undo') )