From e2b9072267faf2e060583e2ab9f74b78ba87239c Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Fri, 22 Apr 2016 21:29:19 +0000 Subject: [PATCH] Dashboard: toggle the "View" link for comments when Approving / Unapproving from the Dashboard widget. Fixes #35518. git-svn-id: https://develop.svn.wordpress.org/trunk@37302 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/dashboard.php | 10 ++++++---- src/wp-admin/js/edit-comments.js | 7 +++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php index 5a234857d8..ecd25a01b1 100644 --- a/src/wp-admin/includes/dashboard.php +++ b/src/wp-admin/includes/dashboard.php @@ -630,9 +630,7 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) { $actions['trash'] = "" . _x( 'Trash', 'verb' ) . ''; } - if ( '1' === $comment->comment_approved ) { - $actions['view'] = '' . __( 'View' ) . ''; - } + $actions['view'] = '' . __( 'View' ) . ''; /** * Filter the action links displayed for each comment in the 'Recent Comments' @@ -653,9 +651,13 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) { ( ( ('approve' == $action || 'unapprove' == $action) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | '; // Reply and quickedit need a hide-if-no-js span - if ( 'reply' == $action || 'quickedit' == $action ) + if ( 'reply' == $action || 'quickedit' == $action ) { $action .= ' hide-if-no-js'; + } + if ( 'view' === $action && '1' !== $comment->comment_approved ) { + $action .= ' hidden'; + } $actions_string .= "$sep$link"; } } diff --git a/src/wp-admin/js/edit-comments.js b/src/wp-admin/js/edit-comments.js index f201362bf0..e0f8a7c048 100644 --- a/src/wp-admin/js/edit-comments.js +++ b/src/wp-admin/js/edit-comments.js @@ -220,12 +220,15 @@ setCommentsList = function() { if ( settings.data.id == replyID ) replyButton.text(adminCommentsL10n.replyApprove); - c.find('div.comment_status').html('0'); + c.find( '.row-actions span.view' ).addClass( 'hidden' ).end() + .find( 'div.comment_status' ).html( '0' ); + } else { if ( settings.data.id == replyID ) replyButton.text(adminCommentsL10n.reply); - c.find('div.comment_status').html('1'); + c.find( '.row-actions span.view' ).removeClass( 'hidden' ).end() + .find( 'div.comment_status' ).html( '1' ); } diff = $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1;