Throttle typing events, fix profile logging, fix group typing

This commit is contained in:
Scott Nonnenberg 2018-12-10 10:21:40 -08:00
parent a8fbd085e2
commit 3851bf351f
4 changed files with 14 additions and 11 deletions

View file

@ -96,6 +96,7 @@
this.messageCollection.on('change:errors', this.handleMessageError, this);
this.messageCollection.on('send-error', this.onMessageError, this);
this.throttledBumpTyping = _.throttle(this.bumpTyping, 300);
const debouncedUpdateLastMessage = _.debounce(
this.updateLastMessage.bind(this),
200
@ -1502,11 +1503,13 @@
// This might throw if we can't pull the avatar down, so we do it last
await c.setProfileAvatar(profile.avatar);
} catch (error) {
window.log.error(
'getProfile error:',
id,
error && error.stack ? error.stack : error
);
if (error.code !== 403 && error.code !== 404) {
window.log.error(
'getProfile error:',
id,
error && error.stack ? error.stack : error
);
}
} finally {
if (c.hasChanged()) {
await window.Signal.Data.updateConversation(id, c.attributes, {

View file

@ -1592,7 +1592,7 @@
maybeBumpTyping() {
const messageText = this.$messageField.val();
if (messageText.length) {
this.model.bumpTyping();
this.model.throttledBumpTyping();
}
},

View file

@ -90,10 +90,10 @@
return verifyMAC(ivAndCiphertext, macKey, mac, 32)
.then(() => {
if (theirDigest !== null) {
return verifyDigest(encryptedBin, theirDigest);
if (!theirDigest) {
throw new Error('Failure: Ask sender to update Signal and resend.');
}
return null;
return verifyDigest(encryptedBin, theirDigest);
})
.then(() => decrypt(aesKey, ciphertext, iv));
},

View file

@ -1,4 +1,4 @@
/* global textsecure, WebAPI, libsignal, OutgoingMessage, window */
/* global _, textsecure, WebAPI, libsignal, OutgoingMessage, window */
/* eslint-disable more/no-then, no-bitwise */
@ -533,7 +533,7 @@ MessageSender.prototype = {
}
const recipients = groupId
? await textsecure.storage.groups.getNumbers(groupId)
? _.without(await textsecure.storage.groups.getNumbers(groupId), myNumber)
: [recipientId];
const groupIdBuffer = groupId
? window.Signal.Crypto.fromEncodedBinaryToArrayBuffer(groupId)