Skip to:
Content

BuddyPress.org

Ticket #7774: 7774.patch

File 7774.patch, 1.5 KB (added by imath, 8 years ago)
  • src/bp-templates/bp-nouveau/js/buddypress-activity-post-form.js

    diff --git src/bp-templates/bp-nouveau/js/buddypress-activity-post-form.js src/bp-templates/bp-nouveau/js/buddypress-activity-post-form.js
    index 6f3038882..30214232b 100644
    window.bp = window.bp || {}; 
    708708                        }
    709709
    710710                        bp.ajax.post( 'post_update', _.extend( data, this.model.attributes ) ).done( function( response ) {
    711                                 var scope     = bp.Nouveau.getStorage( 'bp-activity', 'scope' ),
     711                                var scope     = bp.Nouveau.getStorage( 'bp-activity', 'scope' ), container,
    712712                                        prepended = false;
    713713
     714                                // It's the very first activity, let's make sure the container can welcome it!
     715                                if ( response.is_directory && ! $( '#activity-stream ul.activity-list').length ) {
     716                                        container = $( '<ul></ul>').addClass( 'activity-list item-list bp-list' );
     717                                }
     718
    714719                                if ( ! response.is_directory ||
    715720                                     ( 'all' === scope && ( 'user' === self.model.get( 'object' ) || false === response.is_private ) ) ||
    716721                                     ( self.model.get( 'object' ) + 's'  === scope )
    717722                                    ) {
    718723
    719724                                        if ( ! $( '#activity-' + response.id  ).length ) {
     725                                                // Remove the initial feedback message.
     726                                                if ( container ) {
     727                                                        $( '#activity-stream' ).html( container );
     728                                                }
     729
     730                                                // Prepend the activity into the container.
    720731                                                bp.Nouveau.inject( '#activity-stream ul.activity-list', response.activity, 'prepend' );
    721732                                                prepended = true;
    722733                                        }