diff --git a/js/views/conversation_search_view.js b/js/views/conversation_search_view.js index f1cdc981a..83e9ec813 100644 --- a/js/views/conversation_search_view.js +++ b/js/views/conversation_search_view.js @@ -85,6 +85,11 @@ this.typeahead_view.collection.reset( this.typeahead.filter(isSearchable) ); + + // Check if the query is in the model list + // If it is then hide the new contact view + const modelExists = this.typeahead_view.collection.find(item => item.get('id') === query); + if (modelExists) this.new_contact_view.$el.hide(); }) ); /* eslint-enable more/no-then */ diff --git a/libtextsecure/outgoing_message.js b/libtextsecure/outgoing_message.js index ca1b82180..8a34a4910 100644 --- a/libtextsecure/outgoing_message.js +++ b/libtextsecure/outgoing_message.js @@ -296,6 +296,10 @@ OutgoingMessage.prototype = { this.numberCompleted(); }) .catch(error => { + // TODO(loki): handle http errors properly + // - retry later if 400 + // - ignore if 409 (conflict) means the hash already exists + throw error; if ( error instanceof Error && error.name === 'HTTPError' && @@ -409,6 +413,10 @@ OutgoingMessage.prototype = { } } + if (this.fallBackEncryption && conversation) { + conversation.onFriendRequestSent(); + } + if (attachPrekeys) { log.info('attaching prekeys to outgoing message'); this.message.preKeyBundleMessage = await libloki.getPreKeyBundleForNumber( @@ -417,12 +425,10 @@ OutgoingMessage.prototype = { } }) .then(this.reloadDevicesAndSend(number, true)) - .then(() => { + .catch(error => { if (this.fallBackEncryption && conversation) { - conversation.onFriendRequestSent(); + conversation.onFriendRequestTimedOut(); } - }) - .catch(error => { if (error.message === 'Identity key changed') { // eslint-disable-next-line no-param-reassign error = new textsecure.OutgoingIdentityKeyError(