Skip to:
Content

BuddyPress.org

Changeset 12053


Ignore:
Timestamp:
05/03/2018 07:56:54 PM (7 years ago)
Author:
imath
Message:

Nouveau: make sure all Ajax errors are handled in Messages UI

The Messages UI now informs the user when something went wrong while trying to fetch a single thread or when adding a new reply to a thread failed.

Fixes #7807

Location:
trunk/src/bp-templates/bp-nouveau
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-nouveau/includes/messages/ajax.php

    r12027 r12053  
    108108function bp_nouveau_ajax_messages_send_reply() {
    109109    $response = array(
    110         'feedback' => __( 'There was a problem sending your reply. Please try again.', 'buddypress' ),
     110        'feedback' => '<div class="bp-feedback error"><span class="bp-icon" aria-hidden="true"></span><p>' . __( 'There was a problem sending your reply. Please try again.', 'buddypress' ) . '</p></div>',
    111111        'type'     => 'error',
    112112    );
     
    198198    global $messages_template;
    199199
    200     if ( empty( $_POST['nonce'] ) ||  !wp_verify_nonce( $_POST['nonce'], 'bp_nouveau_messages' ) ) {
     200    if ( empty( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'bp_nouveau_messages' ) ) {
    201201        wp_send_json_error( array(
    202202            'feedback' => '<div class="bp-feedback error"><span class="bp-icon" aria-hidden="true"></span><p>' . __( 'Unauthorized request.', 'buddypress' ) . '</p></div>',
  • trunk/src/bp-templates/bp-nouveau/js/buddypress-messages.js

    r12052 r12053  
    12101210        },
    12111211
    1212         messagesFetchError: function( collection ) {
    1213             console.log( collection );
     1212        messagesFetchError: function( collection, response ) {
     1213            if ( response.feedback && response.type ) {
     1214                bp.Nouveau.Messages.displayFeedback( response.feedback, response.type );
     1215            }
    12141216        },
    12151217
     
    12531255
    12541256        replyError: function( response ) {
    1255             console.log( response );
     1257            if ( response.feedback && response.type ) {
     1258                bp.Nouveau.Messages.displayFeedback( response.feedback, response.type );
     1259            }
    12561260        }
    12571261    } );
Note: See TracChangeset for help on using the changeset viewer.