diff --git a/ts/session/apis/snode_api/factories/StoreGroupRequestFactory.ts b/ts/session/apis/snode_api/factories/StoreGroupRequestFactory.ts index 255c2e143..4bc621747 100644 --- a/ts/session/apis/snode_api/factories/StoreGroupRequestFactory.ts +++ b/ts/session/apis/snode_api/factories/StoreGroupRequestFactory.ts @@ -1,5 +1,5 @@ import { UserGroupsGet } from 'libsession_util_nodejs'; -import { compact, isEmpty } from 'lodash'; +import { compact, isEmpty, uniqBy } from 'lodash'; import { SignalService } from '../../../../protobuf'; import { MetaGroupWrapperActions } from '../../../../webworker/workers/browser/libsession_worker_interface'; import { GroupUpdateInfoChangeMessage } from '../../../messages/outgoing/controlMessage/group_v2/to_group/GroupUpdateInfoChangeMessage'; @@ -40,6 +40,13 @@ async function makeGroupMessageSubRequest( throw new Error('makeGroupMessageSubRequest: not all messages are for the same destination'); } + const allTimestamps = uniqBy(compactedMessages, m => m.createAtNetworkTimestamp); + if (allTimestamps.length !== compactedMessages.length) { + throw new Error( + 'tried to send batch request with messages having the same timestamp, and some platformn do not support this.' + ); + } + const messagesToEncrypt: Array = compactedMessages.map(updateMessage => { const wrapped = MessageWrapper.wrapContentIntoEnvelope( SignalService.Envelope.Type.CLOSED_GROUP_MESSAGE, diff --git a/ts/session/conversations/ConversationController.ts b/ts/session/conversations/ConversationController.ts index 29fe7079c..1d2c84e15 100644 --- a/ts/session/conversations/ConversationController.ts +++ b/ts/session/conversations/ConversationController.ts @@ -695,7 +695,7 @@ async function leaveClosedGroup(groupPk: PubkeyType | GroupPubkeyType, fromSyncM const createAtNetworkTimestamp = NetworkTime.now(); // Send the update to the 03 group const ourLeavingMessage = new GroupUpdateMemberLeftMessage({ - createAtNetworkTimestamp, + createAtNetworkTimestamp: createAtNetworkTimestamp + 1, // we just need it to be different than the one of ourLeavingNotificationMessage groupPk, expirationType: null, // we keep that one **not** expiring expireTimer: null,