diff --git a/ts/groups.ts b/ts/groups.ts index 45a5e945f..20905882c 100644 --- a/ts/groups.ts +++ b/ts/groups.ts @@ -1455,6 +1455,7 @@ export async function modifyGroupV2({ extraConversationsForSend, inviteLinkPassword, name, + syncMessageOnly = false, }: { conversation: ConversationModel; usingCredentialsFrom: ReadonlyArray; @@ -1462,6 +1463,7 @@ export async function modifyGroupV2({ extraConversationsForSend?: ReadonlyArray; inviteLinkPassword?: string; name: string; + syncMessageOnly?: boolean; }): Promise { const logId = `${name}/${conversation.idForLogging()}`; @@ -1561,7 +1563,7 @@ export async function modifyGroupV2({ type: conversationQueueJobEnum.enum.GroupUpdate, conversationId: conversation.id, groupChangeBase64, - recipients: groupV2Info.members.slice(), + recipients: syncMessageOnly ? [] : groupV2Info.members.slice(), revision: groupV2Info.revision, }); }); diff --git a/ts/models/conversations.ts b/ts/models/conversations.ts index d4ee0849b..ab26f7b35 100644 --- a/ts/models/conversations.ts +++ b/ts/models/conversations.ts @@ -755,12 +755,14 @@ export class ConversationModel extends window.Backbone extraConversationsForSend, inviteLinkPassword, name, + syncMessageOnly, }: { usingCredentialsFrom: ReadonlyArray; createGroupChange: () => Promise; extraConversationsForSend?: ReadonlyArray; inviteLinkPassword?: string; name: string; + syncMessageOnly?: boolean; }): Promise { await window.Signal.Groups.modifyGroupV2({ conversation: this, @@ -769,6 +771,7 @@ export class ConversationModel extends window.Backbone extraConversationsForSend, inviteLinkPassword, name, + syncMessageOnly, }); } @@ -2597,6 +2600,7 @@ export class ConversationModel extends window.Backbone name: 'delete', usingCredentialsFrom: [], createGroupChange: () => this.removePendingMember([ourPNI]), + syncMessageOnly: true, }); } else { const logId = this.idForLogging(); diff --git a/ts/test-mock/pnp/accept_gv2_invite_test.ts b/ts/test-mock/pnp/accept_gv2_invite_test.ts index 8106bdfc9..3b7cc809a 100644 --- a/ts/test-mock/pnp/accept_gv2_invite_test.ts +++ b/ts/test-mock/pnp/accept_gv2_invite_test.ts @@ -3,7 +3,7 @@ import { assert } from 'chai'; import type { Group } from '@signalapp/mock-server'; -import { UUIDKind } from '@signalapp/mock-server'; +import { Proto, UUIDKind } from '@signalapp/mock-server'; import createDebug from 'debug'; import * as durations from '../../util/durations'; @@ -159,6 +159,21 @@ describe('pnp/accept gv2 invite', function needsName() { assert(!group.getMemberByUUID(desktop.pni)); assert(!group.getPendingMemberByUUID(desktop.uuid)); assert(!group.getPendingMemberByUUID(desktop.pni)); + + // Verify that sync message was sent. + const { syncMessage } = await phone.waitForSyncMessage(entry => + Boolean(entry.syncMessage.sent?.message?.groupV2?.groupChange) + ); + const groupChangeBuffer = syncMessage.sent?.message?.groupV2?.groupChange; + assert.notEqual(groupChangeBuffer, null); + const groupChange = Proto.GroupChange.decode( + groupChangeBuffer ?? new Uint8Array(0) + ); + assert.notEqual(groupChange.actions, null); + const actions = Proto.GroupChange.Actions.decode( + groupChange?.actions ?? new Uint8Array(0) + ); + assert.strictEqual(actions.deletePendingMembers.length, 1); }); it('should accept ACI invite with extra PNI on the invite list', async () => {