Note to Self timer fixes for bugs reported by beta users
This commit is contained in:
parent
7c4ba5446c
commit
af40ceda6c
3 changed files with 34 additions and 7 deletions
|
@ -1257,10 +1257,24 @@
|
||||||
const sendOptions = this.getSendOptions();
|
const sendOptions = this.getSendOptions();
|
||||||
let promise;
|
let promise;
|
||||||
|
|
||||||
|
if (this.isMe()) {
|
||||||
|
const dataMessage = await textsecure.messaging.getMessageProto(
|
||||||
|
this.get('id'),
|
||||||
|
null,
|
||||||
|
[],
|
||||||
|
null,
|
||||||
|
[],
|
||||||
|
message.get('sent_at'),
|
||||||
|
expireTimer,
|
||||||
|
profileKey
|
||||||
|
);
|
||||||
|
return message.sendSyncMessageOnly(dataMessage);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.get('type') === 'private') {
|
if (this.get('type') === 'private') {
|
||||||
promise = textsecure.messaging.sendExpirationTimerUpdateToNumber(
|
promise = textsecure.messaging.sendExpirationTimerUpdateToNumber(
|
||||||
this.get('id'),
|
this.get('id'),
|
||||||
this.get('expireTimer'),
|
expireTimer,
|
||||||
message.get('sent_at'),
|
message.get('sent_at'),
|
||||||
profileKey,
|
profileKey,
|
||||||
sendOptions
|
sendOptions
|
||||||
|
@ -1269,7 +1283,7 @@
|
||||||
promise = textsecure.messaging.sendExpirationTimerUpdateToGroup(
|
promise = textsecure.messaging.sendExpirationTimerUpdateToGroup(
|
||||||
this.get('id'),
|
this.get('id'),
|
||||||
this.getRecipients(),
|
this.getRecipients(),
|
||||||
this.get('expireTimer'),
|
expireTimer,
|
||||||
message.get('sent_at'),
|
message.get('sent_at'),
|
||||||
profileKey,
|
profileKey,
|
||||||
sendOptions
|
sendOptions
|
||||||
|
|
|
@ -632,7 +632,7 @@
|
||||||
// back to the conversation's current recipients
|
// back to the conversation's current recipients
|
||||||
const phoneNumbers = this.isIncoming()
|
const phoneNumbers = this.isIncoming()
|
||||||
? [this.get('source')]
|
? [this.get('source')]
|
||||||
: this.get('sent_to') || this.conversation.getRecipients();
|
: this.get('sent_to') || this.getConversation().getRecipients();
|
||||||
|
|
||||||
// This will make the error message for outgoing key errors a bit nicer
|
// This will make the error message for outgoing key errors a bit nicer
|
||||||
const allErrors = (this.get('errors') || []).map(error => {
|
const allErrors = (this.get('errors') || []).map(error => {
|
||||||
|
@ -1062,8 +1062,15 @@
|
||||||
this.set({ dataMessage });
|
this.set({ dataMessage });
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this.sendSyncMessage();
|
const result = await this.sendSyncMessage();
|
||||||
this.set({
|
this.set({
|
||||||
|
// These are the same as a normal send
|
||||||
|
sent_to: [this.OUR_NUMBER],
|
||||||
|
sent: true,
|
||||||
|
expirationStartTimestamp: Date.now(),
|
||||||
|
unidentifiedDeliveries: result ? result.unidentifiedDeliveries : null,
|
||||||
|
|
||||||
|
// These are unique to a Note to Self message - immediately read/delivered
|
||||||
delivered_to: [this.OUR_NUMBER],
|
delivered_to: [this.OUR_NUMBER],
|
||||||
read_by: [this.OUR_NUMBER],
|
read_by: [this.OUR_NUMBER],
|
||||||
});
|
});
|
||||||
|
|
|
@ -846,7 +846,7 @@ MessageSender.prototype = {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
const sendToContact = deleteAllSessions(number)
|
const sendToContactPromise = deleteAllSessions(number)
|
||||||
.catch(logError('resetSession/deleteAllSessions1 error:'))
|
.catch(logError('resetSession/deleteAllSessions1 error:'))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
window.log.info(
|
window.log.info(
|
||||||
|
@ -866,8 +866,14 @@ MessageSender.prototype = {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const myNumber = textsecure.storage.user.getNumber();
|
||||||
|
// We already sent the reset session to our other devices in the code above!
|
||||||
|
if (number === myNumber) {
|
||||||
|
return sendToContactPromise;
|
||||||
|
}
|
||||||
|
|
||||||
const buffer = proto.toArrayBuffer();
|
const buffer = proto.toArrayBuffer();
|
||||||
const sendSync = this.sendSyncMessage(
|
const sendSyncPromise = this.sendSyncMessage(
|
||||||
buffer,
|
buffer,
|
||||||
timestamp,
|
timestamp,
|
||||||
number,
|
number,
|
||||||
|
@ -877,7 +883,7 @@ MessageSender.prototype = {
|
||||||
options
|
options
|
||||||
).catch(logError('resetSession/sendSync error:'));
|
).catch(logError('resetSession/sendSync error:'));
|
||||||
|
|
||||||
return Promise.all([sendToContact, sendSync]);
|
return Promise.all([sendToContactPromise, sendSyncPromise]);
|
||||||
},
|
},
|
||||||
|
|
||||||
sendMessageToGroup(
|
sendMessageToGroup(
|
||||||
|
|
Loading…
Add table
Reference in a new issue