In partially-successful group send, don't start expire timer

This commit is contained in:
Scott Nonnenberg 2018-08-06 11:33:51 -07:00
parent 9ed1ee90f8
commit 9ff80469a5

View file

@ -824,7 +824,6 @@
this.trigger('pending'); this.trigger('pending');
return promise return promise
.then(async result => { .then(async result => {
const now = Date.now();
this.trigger('done'); this.trigger('done');
// This is used by sendSyncMessage, then set to null // This is used by sendSyncMessage, then set to null
@ -836,7 +835,7 @@
this.set({ this.set({
sent_to: _.union(sentTo, result.successfulNumbers), sent_to: _.union(sentTo, result.successfulNumbers),
sent: true, sent: true,
expirationStartTimestamp: now, expirationStartTimestamp: Date.now(),
}); });
await window.Signal.Data.saveMessage(this.attributes, { await window.Signal.Data.saveMessage(this.attributes, {
@ -846,7 +845,6 @@
this.sendSyncMessage(); this.sendSyncMessage();
}) })
.catch(result => { .catch(result => {
const now = Date.now();
this.trigger('done'); this.trigger('done');
if (result.dataMessage) { if (result.dataMessage) {
@ -867,10 +865,12 @@
this.saveErrors(result.errors); this.saveErrors(result.errors);
if (result.successfulNumbers.length > 0) { if (result.successfulNumbers.length > 0) {
const sentTo = this.get('sent_to') || []; const sentTo = this.get('sent_to') || [];
// Note: In a partially-successful group send, we do not start
// the expiration timer.
this.set({ this.set({
sent_to: _.union(sentTo, result.successfulNumbers), sent_to: _.union(sentTo, result.successfulNumbers),
sent: true, sent: true,
expirationStartTimestamp: now,
}); });
promises.push(this.sendSyncMessage()); promises.push(this.sendSyncMessage());
} }