Refactor 'waiting' flags into one location, fix timestamp check

This commit is contained in:
Scott Nonnenberg 2019-05-16 15:14:06 -07:00
parent fd36720079
commit e18b6bed1f
6 changed files with 39 additions and 13 deletions

View file

@ -1061,7 +1061,6 @@
quote: quoteWithData,
preview: previewWithData,
sticker: stickerWithData,
needsSync: !this.get('synced'),
expireTimer: this.get('expireTimer'),
profileKey,
group: {
@ -1165,7 +1164,11 @@
// This is used by sendSyncMessage, then set to null
if (result.dataMessage) {
this.set({ dataMessage: result.dataMessage });
// When we're not sending recipient updates, we won't save the dataMessage
// unless it's the first time we attempt to send the message.
if (!this.get('synced') || window.SEND_RECIPIENT_UPDATES) {
this.set({ dataMessage: result.dataMessage });
}
}
const sentTo = this.get('sent_to') || [];
@ -1301,7 +1304,7 @@
const isUpdate = Boolean(this.get('synced'));
// Until isRecipientUpdate sync messages are widely supported, will not send them
if (isUpdate) {
if (isUpdate && !window.SEND_RECIPIENT_UPDATES) {
return Promise.resolve();
}