Skip to:
Content

BuddyPress.org

Changeset 13457


Ignore:
Timestamp:
04/22/2023 07:35:59 AM (3 years ago)
Author:
imath
Message:

BP Nouveau's message UI: make sure the reply action gets needed data

Adding a reply can be done by opening the thread view from the message UI or by directly accessing to this view from its URL.
In both cases, we need to make sure to get the current Thread ID in order to attach the reply to it.
As the Backbone Model or the fallback object are both including an id property, using it is a better choice than trying to access the Backbone Model's id attribute.

Props dave.pullig

Closes https://github.com/buddypress/buddypress/pull/89
See #8870 (trunk)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-nouveau/js/buddypress-messages.js

    r13415 r13457  
    22/* jshint devel: true */
    33/* @since 3.0.0 */
    4 /* @version 10.3.0 */
     4/* @version 11.2.0 */
    55window.wp = window.wp || {};
    66window.bp = window.bp || {};
     
    13551355
    13561356                messagesFetched: function( collection, response ) {
    1357                         if ( response.thread && !! response.thread.length ) {
     1357                        if ( response.thread && !! response.thread.id ) {
    13581358                                this.options.thread = new Backbone.Model( response.thread );
    13591359                        }
     
    13881388
    13891389                        threadItem = this.options.thread;
    1390                         if ( ! threadItem.has( 'id' ) ) {
     1390                        if ( ! threadItem.id ) {
    13911391                                threadItem = this.options.collection.at( 0 );
    13921392                        }
    13931393
    13941394                        this.reply.set ( {
    1395                                 thread_id : threadItem.get( 'id' ),
     1395                                thread_id : threadItem.id,
    13961396                                content   : tinyMCE.activeEditor.getContent(),
    13971397                                sending   : true
Note: See TracChangeset for help on using the changeset viewer.