always lock editor after sending friend request. unlock if error.

pull/23/head
sachaaaaa 7 years ago
parent 4b9fcb98d4
commit dda71cbea1

@ -296,6 +296,10 @@ OutgoingMessage.prototype = {
this.numberCompleted(); this.numberCompleted();
}) })
.catch(error => { .catch(error => {
// TODO(loki): handle http errors properly
// - retry later if 400
// - ignore if 409 (conflict) means the hash already exists
throw error;
if ( if (
error instanceof Error && error instanceof Error &&
error.name === 'HTTPError' && error.name === 'HTTPError' &&
@ -409,6 +413,10 @@ OutgoingMessage.prototype = {
} }
} }
if (this.fallBackEncryption && conversation) {
conversation.onFriendRequestSent();
}
if (attachPrekeys) { if (attachPrekeys) {
log.info('attaching prekeys to outgoing message'); log.info('attaching prekeys to outgoing message');
this.message.preKeyBundleMessage = await libloki.getPreKeyBundleForNumber( this.message.preKeyBundleMessage = await libloki.getPreKeyBundleForNumber(
@ -417,12 +425,10 @@ OutgoingMessage.prototype = {
} }
}) })
.then(this.reloadDevicesAndSend(number, true)) .then(this.reloadDevicesAndSend(number, true))
.then(() => { .catch(error => {
if (this.fallBackEncryption && conversation) { if (this.fallBackEncryption && conversation) {
conversation.onFriendRequestSent(); conversation.onFriendRequestTimedOut();
} }
})
.catch(error => {
if (error.message === 'Identity key changed') { if (error.message === 'Identity key changed') {
// eslint-disable-next-line no-param-reassign // eslint-disable-next-line no-param-reassign
error = new textsecure.OutgoingIdentityKeyError( error = new textsecure.OutgoingIdentityKeyError(

Loading…
Cancel
Save