Don't treat sends to a group with unregistered users as an error
This commit is contained in:
parent
e3ddf280fe
commit
8584a79352
2 changed files with 23 additions and 6 deletions
|
@ -1109,9 +1109,10 @@
|
||||||
conversationId: data.destination,
|
conversationId: data.destination,
|
||||||
type: 'outgoing',
|
type: 'outgoing',
|
||||||
sent: true,
|
sent: true,
|
||||||
expirationStartTimestamp: data.expirationStartTimestamp
|
expirationStartTimestamp: Math.min(
|
||||||
? Math.min(data.expirationStartTimestamp, Date.now())
|
data.expirationStartTimestamp || data.timestamp || Date.now(),
|
||||||
: null,
|
Date.now()
|
||||||
|
),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -879,17 +879,33 @@
|
||||||
promises.push(c.getProfiles());
|
promises.push(c.getProfiles());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
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
|
// In groups, we don't treat unregistered users as a user-visible
|
||||||
// the expiration timer.
|
// error. The message will look successful, but the details
|
||||||
|
// screen will show that we didn't send to these unregistered users.
|
||||||
|
const filteredErrors = _.reject(
|
||||||
|
result.errors,
|
||||||
|
error => error.name === 'UnregisteredUserError'
|
||||||
|
);
|
||||||
|
|
||||||
|
// We don't start the expiration timer if there are real errors
|
||||||
|
// left after filtering out all of the unregistered user errors.
|
||||||
|
const expirationStartTimestamp = filteredErrors.length
|
||||||
|
? null
|
||||||
|
: Date.now();
|
||||||
|
|
||||||
|
this.saveErrors(filteredErrors);
|
||||||
|
|
||||||
this.set({
|
this.set({
|
||||||
sent_to: _.union(sentTo, result.successfulNumbers),
|
sent_to: _.union(sentTo, result.successfulNumbers),
|
||||||
sent: true,
|
sent: true,
|
||||||
|
expirationStartTimestamp,
|
||||||
});
|
});
|
||||||
promises.push(this.sendSyncMessage());
|
promises.push(this.sendSyncMessage());
|
||||||
|
} else {
|
||||||
|
this.saveErrors(result.errors);
|
||||||
}
|
}
|
||||||
promises = promises.concat(
|
promises = promises.concat(
|
||||||
_.map(result.errors, error => {
|
_.map(result.errors, error => {
|
||||||
|
|
Loading…
Reference in a new issue