Ticket #36742: 36742.2.patch
File 36742.2.patch, 2.7 KB (added by , 9 years ago) |
---|
-
src/wp-admin/includes/ajax-actions.php
352 352 353 353 // JS didn't send us everything we need to know. Just die with success message 354 354 if ( ! $total || ! $per_page || ! $page || ! $url ) { 355 $time = time(); 356 $comment = get_comment( $comment_id ); 355 $time = time(); 356 $comment = get_comment( $comment_id ); 357 $comment_status = ''; 358 $comment_link = ''; 357 359 360 if ( $comment ) { 361 $comment_status = $comment->comment_approved; 362 } 363 364 // If the comment is approved, add a link to the comment so the JavaScript can link the date. 365 if ( 1 === (int) $comment_status ) { 366 $comment_link = get_comment_link( $comment ); 367 } 368 358 369 $counts = wp_count_comments(); 359 370 360 371 $x = new WP_Ajax_Response( array( … … 362 373 // Here for completeness - not used. 363 374 'id' => $comment_id, 364 375 'supplemental' => array( 365 'status' => $comment ? $comment->comment_approved : '',376 'status' => $comment_status, 366 377 'postId' => $comment ? $comment->comment_post_ID : '', 367 378 'time' => $time, 368 379 'in_moderation' => $counts->moderated, … … 373 384 'i18n_moderation_text' => sprintf( 374 385 _nx( '%s in moderation', '%s in moderation', $counts->moderated, 'comments' ), 375 386 number_format_i18n( $counts->moderated ) 376 ) 387 ), 388 'comment_link' => $comment_link, 377 389 ) 378 390 ) ); 379 391 $x->send(); -
src/wp-includes/js/wp-lists.js
297 297 res = wpAjax.parseAjaxResponse(r, s.response, s.element); 298 298 rres = r; 299 299 300 // Handle the specific case for the "submitted on" link of Comments List Table. 301 if ( 'undefined' !== typeof res.responses[0].supplemental.comment_link ) { 302 var submittedOn = element.find( '.submitted-on' ), 303 commentLink = submittedOn.find( 'a' ); 304 305 // Comment is approved; link the date field. 306 if ( '' !== res.responses[0].supplemental.comment_link ) { 307 submittedOn.html( $('<a></a>').text( submittedOn.text() ).prop( 'href', res.responses[0].supplemental.comment_link ) ); 308 309 // Comment is not approved; unlink the dte field. 310 } else if ( commentLink.length ) { 311 submittedOn.text( commentLink.text() ); 312 } 313 } 314 300 315 if ( !res || res.errors ) { 301 316 element.stop().stop().css( 'backgroundColor', '#FF3333' )[isClass?'removeClass':'addClass'](s.dimClass).show().queue( function() { list.wpList.recolor(); $(this).dequeue(); } ); 302 317 return false;