Make WordPress Core


Ignore:
Timestamp:
08/20/2015 02:50:20 AM (10 years ago)
Author:
wonderboymusic
Message:

Comments List Table:

  • Show count next to "Approved"
  • Properly increment/decrement counts when row actions are clicked
  • In _wp_ajax_delete_comment_response(), return the comment's status with the supplemental data
  • Handle counts properly on each scenario of undo

See #11200.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r33468 r33655  
    348348
    349349    // JS didn't send us everything we need to know. Just die with success message
    350     if ( !$total || !$per_page || !$page || !$url )
    351         wp_die( time() );
     350    if ( ! $total || ! $per_page || ! $page || ! $url ) {
     351        $time = time();
     352        $comment = get_comment( $comment_id );
     353
     354        $x = new WP_Ajax_Response( array(
     355            'what' => 'comment',
     356            // Here for completeness - not used.
     357            'id' => $comment_id,
     358            'supplemental' => array(
     359                'status' => $comment ? $comment->comment_approved : '',
     360                'time' => $time
     361            )
     362        ) );
     363        $x->send();
     364    }
    352365
    353366    $total += $delta;
     
    378391    // The time since the last comment count.
    379392    $time = time();
     393    $comment = get_comment( $comment_id );
    380394
    381395    $x = new WP_Ajax_Response( array(
     
    384398        'id' => $comment_id,
    385399        'supplemental' => array(
     400            'status' => $comment ? $comment->comment_approved : '',
    386401            'total_items_i18n' => sprintf( _n( '%s item', '%s items', $total ), number_format_i18n( $total ) ),
    387402            'total_pages' => ceil( $total / $per_page ),
Note: See TracChangeset for help on using the changeset viewer.