@ -316,7 +316,6 @@
renderErrors ( ) {
renderErrors ( ) {
const errors = this . model . get ( 'errors' ) ;
const errors = this . model . get ( 'errors' ) ;
this . $ ( '.error-icon-container' ) . remove ( ) ;
this . $ ( '.error-icon-container' ) . remove ( ) ;
if ( this . errorIconView ) {
if ( this . errorIconView ) {
this . errorIconView . remove ( ) ;
this . errorIconView . remove ( ) ;
@ -437,16 +436,18 @@
} ;
} ;
if ( this . replyView ) {
if ( this . replyView ) {
this . replyView . remove ( ) ;
this . replyView = null ;
this . replyView = null ;
} else if ( contact ) {
} else if ( contact ) {
this . listenTo ( contact , 'change:color' , this . renderQuote ) ;
this . listenTo ( contact , 'change:color' , this . renderQuote ) ;
}
}
this . replyView = new Whisper . ReactWrapperView ( {
this . replyView = new Whisper . ReactWrapperView ( {
el: this . $ ( '.quote-wrapper' ) ,
className: 'quote-wrapper' ,
Component : window . Signal . Components . Quote ,
Component : window . Signal . Components . Quote ,
props ,
props ,
} ) ;
} ) ;
this . $ ( '.inner-bubble' ) . prepend ( this . replyView . el ) ;
} ,
} ,
isImageWithoutCaption ( ) {
isImageWithoutCaption ( ) {
const attachments = this . model . get ( 'attachments' ) ;
const attachments = this . model . get ( 'attachments' ) ;
@ -469,16 +470,23 @@
render ( ) {
render ( ) {
const contact = this . model . isIncoming ( ) ? this . model . getContact ( ) : null ;
const contact = this . model . isIncoming ( ) ? this . model . getContact ( ) : null ;
const errors = this . model . get ( 'errors' ) ;
const errors = this . model . get ( 'errors' ) ;
const attachments = this . model . get ( 'attachments' ) ;
const hasErrors = errors && errors . length > 0 ;
const hasErrors = errors && errors . length > 0 ;
const hasAttachments = attachments && attachments . length > 0 ;
const message = this . model . get ( 'body' ) ;
const hasBody = message || ( this . model . isIncoming ( ) && hasErrors ) ;
this . $el . html ( Mustache . render ( _ . result ( this , 'template' , '' ) , {
this . $el . html ( Mustache . render ( _ . result ( this , 'template' , '' ) , {
message : this . model . get ( 'body' ) ,
message ,
hasBody ,
timestamp : this . model . get ( 'sent_at' ) ,
timestamp : this . model . get ( 'sent_at' ) ,
sender : ( contact && contact . getTitle ( ) ) || '' ,
sender : ( contact && contact . getTitle ( ) ) || '' ,
avatar : ( contact && contact . getAvatar ( ) ) ,
avatar : ( contact && contact . getAvatar ( ) ) ,
profileName : ( contact && contact . getProfileName ( ) ) ,
profileName : ( contact && contact . getProfileName ( ) ) ,
innerBubbleClasses : this . isImageWithoutCaption ( ) ? '' : 'with-tail' ,
innerBubbleClasses : this . isImageWithoutCaption ( ) ? '' : 'with-tail' ,
hoverIcon : ! hasErrors ,
hoverIcon : ! hasErrors ,
hasAttachments ,
} , this . render _partials ( ) ) ) ;
} , this . render _partials ( ) ) ) ;
this . timeStampView . setElement ( this . $ ( '.timestamp' ) ) ;
this . timeStampView . setElement ( this . $ ( '.timestamp' ) ) ;
this . timeStampView . update ( ) ;
this . timeStampView . update ( ) ;