Fix message sending

pull/27/head
Mikunj 7 years ago
parent 98185fa6fd
commit 2fabd93fd6

@ -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()) {

@ -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) {

@ -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

Loading…
Cancel
Save