@ -545,6 +545,7 @@
} ,
} ,
focusMessageField : function ( ) {
focusMessageField : function ( ) {
this . $messageField . prop ( 'disabled' , false ) ;
this . $messageField . focus ( ) ;
this . $messageField . focus ( ) ;
} ,
} ,
@ -857,6 +858,9 @@
} ,
} ,
checkUnverifiedSendMessage : function ( e , options ) {
checkUnverifiedSendMessage : function ( e , options ) {
e . preventDefault ( ) ;
this . $messageField . prop ( 'disabled' , true ) ;
options = options || { } ;
options = options || { } ;
_ . defaults ( options , { force : false } ) ;
_ . defaults ( options , { force : false } ) ;
@ -876,11 +880,12 @@
this . showSendConfirmationDialog ( e , contacts ) ;
this . showSendConfirmationDialog ( e , contacts ) ;
} . bind ( this ) ) . catch ( function ( error ) {
} . bind ( this ) ) . catch ( function ( error ) {
this . focusMessageField ( ) ;
console . log (
console . log (
'checkUnverifiedSendMessage error:' ,
'checkUnverifiedSendMessage error:' ,
error && error . stack ? error . stack : error
error && error . stack ? error . stack : error
) ;
) ;
} );
} .bind ( this ) );
} ,
} ,
checkUntrustedSendMessage : function ( e , options ) {
checkUntrustedSendMessage : function ( e , options ) {
@ -900,11 +905,12 @@
this . showSendConfirmationDialog ( e , contacts ) ;
this . showSendConfirmationDialog ( e , contacts ) ;
} . bind ( this ) ) . catch ( function ( error ) {
} . bind ( this ) ) . catch ( function ( error ) {
this . focusMessageField ( ) ;
console . log (
console . log (
'checkUntrustedSendMessage error:' ,
'checkUntrustedSendMessage error:' ,
error && error . stack ? error . stack : error
error && error . stack ? error . stack : error
) ;
) ;
} );
} .bind ( this ) );
} ,
} ,
sendMessage : function ( e ) {
sendMessage : function ( e ) {
@ -924,22 +930,24 @@
if ( toast ) {
if ( toast ) {
toast . $el . insertAfter ( this . $el ) ;
toast . $el . insertAfter ( this . $el ) ;
toast . render ( ) ;
toast . render ( ) ;
this . focusMessageField ( ) ;
return ;
return ;
}
}
e . preventDefault ( ) ;
var input = this . $messageField ;
var input = this . $messageField ;
var message = this . replace _colons ( input . val ( ) ) . trim ( ) ;
var message = this . replace _colons ( input . val ( ) ) . trim ( ) ;
var convo = this . model ;
this . focusMessageField ( ) ;
if ( message . length > 0 || this . fileInput . hasFiles ( ) ) {
if ( message . length > 0 || this . fileInput . hasFiles ( ) ) {
this . fileInput . getFiles ( ) . then ( function ( attachments ) {
this . fileInput . getFiles ( ) . then ( function ( attachments ) {
convo . sendMessage ( message , attachments ) ;
this . model . sendMessage ( message , attachments ) ;
} ) ;
input . val ( "" ) ;
input . val ( "" ) ;
this . focusMessageField ( ) ;
this . forceUpdateMessageFieldSize ( e ) ;
this . forceUpdateMessageFieldSize ( e ) ;
this . fileInput . deleteFiles ( ) ;
this . fileInput . deleteFiles ( ) ;
} . bind ( this ) ) . catch ( function ( ) {
console . log ( 'Error pulling attached files before send' ) ;
this . focusMessageField ( ) ;
} . bind ( this ) ) ;
}
}
} ,
} ,