handle sync for closed groups update as we do for regular messages

pull/1235/head
Audric Ackermann 5 years ago
parent 4381d0135f
commit b5e5b3856d
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -1890,6 +1890,7 @@
const updateParams = { const updateParams = {
// if we do set an identifier here, be sure to not sync the message two times in msg.handleMessageSentSuccess() // if we do set an identifier here, be sure to not sync the message two times in msg.handleMessageSentSuccess()
identifier: messageId,
timestamp: now, timestamp: now,
groupId: id, groupId: id,
name: name || this.getName(), name: name || this.getName(),
@ -1901,7 +1902,7 @@
updateParams updateParams
); );
await this.sendClosedGroupMessageWithSync(groupUpdateMessage, recipients); await this.sendClosedGroupMessage(groupUpdateMessage, recipients);
if (groupUpdate.joined && groupUpdate.joined.length) { if (groupUpdate.joined && groupUpdate.joined.length) {
const expireUpdate = { const expireUpdate = {
@ -2010,13 +2011,13 @@
quitGroup quitGroup
); );
await this.sendClosedGroupMessageWithSync(quitGroupMessage); await this.sendClosedGroupMessage(quitGroupMessage);
this.updateTextInputState(); this.updateTextInputState();
} }
}, },
async sendClosedGroupMessageWithSync(message, recipients) { async sendClosedGroupMessage(message, recipients) {
const { const {
ClosedGroupMessage, ClosedGroupMessage,
ClosedGroupChatMessage, ClosedGroupChatMessage,
@ -2050,16 +2051,6 @@
.sendUsingMultiDevice(memberPubKey, message); .sendUsingMultiDevice(memberPubKey, message);
}); });
await Promise.all(sendPromises); await Promise.all(sendPromises);
// Send the sync message to our devices
const syncMessage = new libsession.Messages.Outgoing.SentSyncMessage({
timestamp: Date.now(),
identifier: message.identifier,
destination: message.groupId,
dataMessage: message.dataProto(),
});
await libsession.getMessageQueue().sendSyncMessage(syncMessage);
} catch (e) { } catch (e) {
window.log.error(e); window.log.error(e);
} }

@ -1245,7 +1245,7 @@
); );
const { dataMessage } = contentDecoded; const { dataMessage } = contentDecoded;
if (dataMessage) { if (dataMessage) {
this.sendSyncMessage(dataMessage); await this.sendSyncMessage(dataMessage);
} }
} else if (shouldMarkMessageAsSynced) { } else if (shouldMarkMessageAsSynced) {
this.set({ synced: true }); this.set({ synced: true });

Loading…
Cancel
Save