Skip to:
Content

BuddyPress.org

Changeset 13416


Ignore:
Timestamp:
02/10/2023 03:48:32 AM (2 years ago)
Author:
imath
Message:

BP Nouveau: Make sure the thread ID is transported into thread view

The Backbone based Messages UI of the Nouveau template pack is now looking for the displayed thread ID inside the messages collection if the current thread object hasn't been returned by the Ajax request. This prevent an error that was happening when trying to reply to a thread message after the thread has been displayed without re-requesting the server.

Props casper99

Fixes #8825 (branch 11.0)

Location:
branches/11.0/src/bp-templates/bp-nouveau
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/11.0/src/bp-templates/bp-nouveau/buddypress/common/js-templates/messages/index.php

    r13200 r13416  
    156156        <div class="thread-subject">
    157157            <span class="thread-count">({{data.count}})</span>
    158             <a class="subject" href="../view/{{data.id}}/">{{data.subject}}</a>
     158            <a class="subject" href="./view/{{data.id}}/">{{data.subject}}</a>
    159159        </div>
    160160        <p class="excerpt">{{data.excerpt}}</p>
  • branches/11.0/src/bp-templates/bp-nouveau/js/buddypress-messages.js

    r13369 r13416  
    13551355
    13561356        messagesFetched: function( collection, response ) {
    1357             if ( ! _.isUndefined( response.thread ) ) {
     1357            if ( response.thread && !! response.thread.length ) {
    13581358                this.options.thread = new Backbone.Model( response.thread );
    13591359            }
     
    13801380
    13811381        sendReply: function( event ) {
     1382            var threadItem;
    13821383            event.preventDefault();
    13831384
     
    13861387            }
    13871388
     1389            threadItem = this.options.thread;
     1390            if ( ! threadItem.has( 'id' ) ) {
     1391                threadItem = this.options.collection.at( 0 );
     1392            }
     1393
    13881394            this.reply.set ( {
    1389                 thread_id : this.options.thread.get( 'id' ),
     1395                thread_id : threadItem.get( 'id' ),
    13901396                content   : tinyMCE.activeEditor.getContent(),
    13911397                sending   : true
Note: See TracChangeset for help on using the changeset viewer.