Fail over to all numbers in retry if errors don't have numbers

This commit is contained in:
Scott Nonnenberg 2019-01-28 15:24:46 -08:00
parent 92c071e083
commit 1533fcc807
2 changed files with 16 additions and 6 deletions

View file

@ -711,13 +711,23 @@
this.set({ errors });
const profileKey = null;
const numbers = retries.map(retry => retry.number);
let numbers = retries
.map(retry => retry.number)
.filter(item => Boolean(item));
if (!numbers.length) {
window.log.error(
'retrySend: Attempted to retry, but no numbers to send to!'
window.log.warn(
'retrySend: No numbers in error set, using all recipients'
);
return null;
const conversation = this.getConversation();
if (conversation) {
numbers = conversation.getRecipients();
this.set({ errors: null });
} else {
throw new Error(
'No numbers in error set, did not find conversation for message'
);
}
}
const attachmentsWithData = await Promise.all(