mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-12 13:44:21 +01:00
Comments: Wrap or unwrap the List Table comment_date as comment status changes via Ajax.
Introduced in [36521]. Fixes #36742. Props imath, adamsilverstein. Built from https://develop.svn.wordpress.org/trunk@37743 git-svn-id: http://core.svn.wordpress.org/trunk@37708 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
dd5bc0d28e
commit
d7e743a286
@ -352,8 +352,18 @@ function _wp_ajax_delete_comment_response( $comment_id, $delta = -1 ) {
|
||||
|
||||
// JS didn't send us everything we need to know. Just die with success message
|
||||
if ( ! $total || ! $per_page || ! $page || ! $url ) {
|
||||
$time = time();
|
||||
$comment = get_comment( $comment_id );
|
||||
$time = time();
|
||||
$comment = get_comment( $comment_id );
|
||||
$comment_status = '';
|
||||
$comment_link = '';
|
||||
|
||||
if ( $comment ) {
|
||||
$comment_status = $comment->comment_approved;
|
||||
}
|
||||
|
||||
if ( 1 === (int) $comment_status ) {
|
||||
$comment_link = get_comment_link( $comment );
|
||||
}
|
||||
|
||||
$counts = wp_count_comments();
|
||||
|
||||
@ -362,7 +372,7 @@ function _wp_ajax_delete_comment_response( $comment_id, $delta = -1 ) {
|
||||
// Here for completeness - not used.
|
||||
'id' => $comment_id,
|
||||
'supplemental' => array(
|
||||
'status' => $comment ? $comment->comment_approved : '',
|
||||
'status' => $comment_status,
|
||||
'postId' => $comment ? $comment->comment_post_ID : '',
|
||||
'time' => $time,
|
||||
'in_moderation' => $counts->moderated,
|
||||
@ -373,7 +383,8 @@ function _wp_ajax_delete_comment_response( $comment_id, $delta = -1 ) {
|
||||
'i18n_moderation_text' => sprintf(
|
||||
_nx( '%s in moderation', '%s in moderation', $counts->moderated, 'comments' ),
|
||||
number_format_i18n( $counts->moderated )
|
||||
)
|
||||
),
|
||||
'comment_link' => $comment_link,
|
||||
)
|
||||
) );
|
||||
$x->send();
|
||||
|
@ -297,6 +297,20 @@ wpList = {
|
||||
res = wpAjax.parseAjaxResponse(r, s.response, s.element);
|
||||
rres = r;
|
||||
|
||||
if ( 'undefined' !== typeof res.responses[0].supplemental.comment_link ) {
|
||||
var submittedOn = element.find( '.submitted-on' ),
|
||||
commentLink = submittedOn.find( 'a' );
|
||||
|
||||
// Comment is approved; link the date field.
|
||||
if ( '' !== res.responses[0].supplemental.comment_link ) {
|
||||
submittedOn.html( $('<a></a>').text( submittedOn.text() ).prop( 'href', res.responses[0].supplemental.comment_link ) );
|
||||
|
||||
// Comment is not approved; unlink the date field.
|
||||
} else if ( commentLink.length ) {
|
||||
submittedOn.text( commentLink.text() );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !res || res.errors ) {
|
||||
element.stop().stop().css( 'backgroundColor', '#FF3333' )[isClass?'removeClass':'addClass'](s.dimClass).show().queue( function() { list.wpList.recolor(); $(this).dequeue(); } );
|
||||
return false;
|
||||
|
2
wp-includes/js/wp-lists.min.js
vendored
2
wp-includes/js/wp-lists.min.js
vendored
File diff suppressed because one or more lines are too long
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.6-alpha-37742';
|
||||
$wp_version = '4.6-alpha-37743';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user