diff --git a/js/models/conversations.js b/js/models/conversations.js index 721d1b543..9a92e1696 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -418,14 +418,22 @@ } }, onFriendRequestAccepted() { - this.save({ friendRequestStatus: null }); + window.Signal.Data.updateConversation( + this.id, + { friendRequestStatus: null }, + { Conversation: Whisper.Conversation } + ); this.trigger('disable:input', false); this.trigger('change:placeholder', 'chat'); }, onFriendRequestTimedOut() { const friendRequestStatus = this.getFriendRequestStatus(); friendRequestStatus.allowSending = true; - this.save({ friendRequestStatus }); + window.Signal.Data.updateConversation( + this.id, + { friendRequestStatus }, + { Conversation: Whisper.Conversation } + ); this.trigger('disable:input', false); this.trigger('change:placeholder', 'friend-request'); }, @@ -447,7 +455,11 @@ this.onFriendRequestTimedOut(); }, delayMs); - this.save({ friendRequestStatus }); + window.Signal.Data.updateConversation( + this.id, + { friendRequestStatus }, + { Conversation: Whisper.Conversation } + ); }, isUnverified() { if (this.isPrivate()) { diff --git a/js/modules/data.js b/js/modules/data.js index eaf1e8a7b..17730e1d9 100644 --- a/js/modules/data.js +++ b/js/modules/data.js @@ -58,6 +58,7 @@ module.exports = { createOrUpdatePreKey, getPreKeyById, + getPreKeyByRecipient, bulkAddPreKeys, removePreKeyById, removeAllPreKeys, @@ -398,8 +399,8 @@ async function getPreKeyById(id) { const data = await channels.getPreKeyById(id); return keysToArrayBuffer(PRE_KEY_KEYS, data); } -async function getPreKeyByRecipent(recipient) { - const data = await channels.getPreKeyByRecipent(recipient); +async function getPreKeyByRecipient(recipient) { + const data = await channels.getPreKeyByRecipient(recipient); return keysToArrayBuffer(PRE_KEY_KEYS, data); } async function bulkAddPreKeys(array) { diff --git a/libtextsecure/outgoing_message.js b/libtextsecure/outgoing_message.js index ec4050b0f..11ff4d1ce 100644 --- a/libtextsecure/outgoing_message.js +++ b/libtextsecure/outgoing_message.js @@ -134,27 +134,7 @@ OutgoingMessage.prototype = { }) ); // TODO: check if still applicable - - const { numberInfo } = this; - const info = numberInfo && numberInfo[number] ? numberInfo[number] : {}; - const { accessKey } = info || {}; - if (updateDevices === undefined) { - if (accessKey) { - return this.server - .getKeysForNumberUnauth(number, '*', { accessKey }) - .catch(error => { - if (error.code === 401 || error.code === 403) { - if (this.failoverNumbers.indexOf(number) === -1) { - this.failoverNumbers.push(number); - } - return this.server.getKeysForNumber(number, '*'); - } - throw error; - }) - .then(handleResult); - } - return this.server.getKeysForNumber(number, '*').then(handleResult); } let promise = Promise.resolve(true); @@ -263,6 +243,7 @@ OutgoingMessage.prototype = { const ciphers = {}; const plaintext = this.getPlaintext(); + /* Disabled because i'm not sure how senderCertificate works :thinking: const { numberInfo, senderCertificate } = this; const info = numberInfo && numberInfo[number] ? numberInfo[number] : {}; const { accessKey } = info || {}; @@ -289,11 +270,12 @@ OutgoingMessage.prototype = { deviceId === ourDeviceId || deviceId === parseInt(ourDeviceId, 10) ); } + */ return Promise.all( deviceIds.map(async deviceId => { const address = new libsignal.SignalProtocolAddress(number, deviceId); - + const ourNumber = textsecure.storage.user.getNumber(); const options = {}; // No limit on message keys if we're communicating with our other devices