@ -30,23 +30,13 @@
collection : this . conversations
collection : this . conversations
} ) ;
} ) ;
this . conversations . fetchActive ( { reset : true } ) . then ( function ( ) {
this . conversations . fetchActive ( { reset : true } ) ;
if ( this . conversations . length ) {
this . conversations . at ( 0 ) . trigger ( 'open' ) ;
}
} . bind ( this ) ) ;
extension . on ( 'message' , function ( message ) {
extension . on ( 'message' , function ( message ) {
this . conversations . fetch ( { id : message . conversationId } ) . then ( function ( ) {
this . conversations . fetch ( { id : message . conversationId } ) . then ( function ( ) {
this . conversations . get ( message . conversationId ) . fetchMessages ( ) ;
this . conversations . get ( message . conversationId ) . fetchMessages ( ) ;
} . bind ( this ) ) ;
} . bind ( this ) ) ;
} . bind ( this ) ) ;
} . bind ( this ) ) ;
this . conversations . on ( 'selected' , function ( view ) {
$ ( '.conversation' ) . hide ( ) . trigger ( 'close' ) ; // detach any existing conversation views
this . setContent ( view . $el . show ( ) ) ;
view . render ( ) ;
} , this ) ;
} ,
} ,
events : {
events : {
'click #new-message' : 'new_message' ,
'click #new-message' : 'new_message' ,