Update WordPress to 5.2

This commit is contained in:
Oliver Davies 2019-05-08 08:05:39 +01:00
parent 489b5a5914
commit e00f87f2f5
599 changed files with 119573 additions and 55990 deletions

View file

@ -7,7 +7,7 @@
(function($) {
var getCount, updateCount, updateCountText, updatePending, updateApproved,
updateHtmlTitle, updateDashboardText, adminTitle = document.title,
updateHtmlTitle, updateDashboardText, updateInModerationText, adminTitle = document.title,
isDashboard = $('#dashboard_right_now').length,
titleDiv, titleRegEx;
@ -86,20 +86,38 @@ var getCount, updateCount, updateCountText, updatePending, updateApproved,
});
};
updateDashboardText = function ( response ) {
updateDashboardText = function( response ) {
if ( ! isDashboard || ! response || ! response.i18n_comments_text ) {
return;
}
var rightNow = $( '#dashboard_right_now' );
$( '.comment-count a', rightNow ).text( response.i18n_comments_text );
$( '.comment-mod-count a', rightNow ).text( response.i18n_moderation_text )
.parent()
[ response.in_moderation > 0 ? 'removeClass' : 'addClass' ]( 'hidden' );
$( '.comment-count a', '#dashboard_right_now' ).text( response.i18n_comments_text );
};
updateHtmlTitle = function ( diff ) {
/**
* Updates the "comments in moderation" text across the UI.
*
* @since 5.2.0
*
* @param {object} response Ajax response from the server.
*
* @return {void}
*/
updateInModerationText = function( response ) {
if ( ! response || ! response.i18n_moderation_text ) {
return;
}
// Update the "comment in moderation" text across the UI.
$( '.comments-in-moderation-text' ).text( response.i18n_moderation_text );
// Hide the "comment in moderation" text in the Dashboard "At a Glance" widget.
if ( isDashboard && response.in_moderation ) {
$( '.comment-mod-count', '#dashboard_right_now' )
[ response.in_moderation > 0 ? 'removeClass' : 'addClass' ]( 'hidden' );
}
};
updateHtmlTitle = function( diff ) {
var newTitle, regExMatch, titleCount, commentFrag;
titleRegEx = titleRegEx || new RegExp( adminCommentsL10n.docTitleCommentsCount.replace( '%s', '\\([0-9' + thousandsSeparator + ']+\\)' ) + '?' );
@ -238,6 +256,7 @@ window.setCommentsList = function() {
diff = $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1;
if ( response ) {
updateDashboardText( response.supplemental );
updateInModerationText( response.supplemental );
updatePending( diff, response.supplemental.postId );
updateApproved( -1 * diff, response.supplemental.postId );
} else {
@ -288,7 +307,7 @@ window.setCommentsList = function() {
a = $('.undo a', '#undo-' + id);
a.attr('href', 'comment.php?action=un' + action + 'comment&c=' + id + '&_wpnonce=' + settings.data._ajax_nonce);
a.attr('data-wp-lists', 'delete:the-comment-list:comment-' + id + '::un' + action + '=1');
a.attr('class', 'vim-z vim-destructive');
a.attr('class', 'vim-z vim-destructive aria-button-if-js');
$('.avatar', el).first().clone().prependTo('#undo-' + id + ' .' + action + '-undo-inside');
a.click(function( e ){
@ -318,13 +337,18 @@ window.setCommentsList = function() {
spamDiff, trashDiff, pendingDiff, approvedDiff,
approved = commentRow.hasClass( 'approved' ),
/*
* As `wpList` toggles only the `unapproved` class, the approved comment
* rows can have both the `approved` and `unapproved` classes.
*/
approved = commentRow.hasClass( 'approved' ) && ! commentRow.hasClass( 'unapproved' ),
unapproved = commentRow.hasClass( 'unapproved' ),
spammed = commentRow.hasClass( 'spam' ),
trashed = commentRow.hasClass( 'trash' ),
undoing = false; // ticket #35904
updateDashboardText( newTotal );
updateInModerationText( newTotal );
// the order of these checks is important
// .unspam can also have .approve or .unapprove
@ -508,7 +532,7 @@ window.setCommentsList = function() {
refillTheExtraList();
animated = $( ':animated', '#the-comment-list' );
animatedCallback = function () {
animatedCallback = function() {
if ( ! $( '#the-comment-list tr:visible' ).length ) {
theList.get(0).wpList.add( theExtraList.find( '.no-items' ).clone() );
}
@ -582,8 +606,8 @@ window.commentReply = {
init : function() {
var row = $('#replyrow');
$('a.cancel', row).click(function() { return commentReply.revert(); });
$('a.save', row).click(function() { return commentReply.send(); });
$( '.cancel', row ).click( function() { return commentReply.revert(); } );
$( '.save', row ).click( function() { return commentReply.send(); } );
$( 'input#author-name, input#author-email, input#author-url', row ).keypress( function( e ) {
if ( e.which == 13 ) {
commentReply.send();
@ -603,10 +627,6 @@ window.commentReply = {
});
this.comments_listing = $('#comments-form > input[name="comment_status"]').val() || '';
/* $(listTable).bind('beforeChangePage', function(){
commentReply.close();
}); */
},
addEvents : function(r) {
@ -631,8 +651,6 @@ window.commentReply = {
$('#replyrow').fadeOut('fast', function(){
commentReply.close();
});
return false;
},
close : function() {
@ -808,8 +826,6 @@ window.commentReply = {
success : function(x) { commentReply.show(x); },
error : function(r) { commentReply.error(r); }
});
return false;
},
show : function(xml) {
@ -847,12 +863,10 @@ window.commentReply = {
}
if ( r.supplemental.i18n_comments_text ) {
if ( isDashboard ) {
updateDashboardText( r.supplemental );
} else {
updateApproved( 1, r.supplemental.parent_post_id );
updateCountText( 'span.all-count', 1 );
}
updateDashboardText( r.supplemental );
updateInModerationText( r.supplemental );
updateApproved( 1, r.supplemental.parent_post_id );
updateCountText( 'span.all-count', 1 );
}
c = $.trim(r.data); // Trim leading whitespaces