Don't send group update on PNI decline
This commit is contained in:
parent
a31cf5645e
commit
3ff390e1c4
3 changed files with 23 additions and 2 deletions
|
@ -1455,6 +1455,7 @@ export async function modifyGroupV2({
|
|||
extraConversationsForSend,
|
||||
inviteLinkPassword,
|
||||
name,
|
||||
syncMessageOnly = false,
|
||||
}: {
|
||||
conversation: ConversationModel;
|
||||
usingCredentialsFrom: ReadonlyArray<ConversationModel>;
|
||||
|
@ -1462,6 +1463,7 @@ export async function modifyGroupV2({
|
|||
extraConversationsForSend?: ReadonlyArray<string>;
|
||||
inviteLinkPassword?: string;
|
||||
name: string;
|
||||
syncMessageOnly?: boolean;
|
||||
}): Promise<void> {
|
||||
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,
|
||||
});
|
||||
});
|
||||
|
|
|
@ -755,12 +755,14 @@ export class ConversationModel extends window.Backbone
|
|||
extraConversationsForSend,
|
||||
inviteLinkPassword,
|
||||
name,
|
||||
syncMessageOnly,
|
||||
}: {
|
||||
usingCredentialsFrom: ReadonlyArray<ConversationModel>;
|
||||
createGroupChange: () => Promise<Proto.GroupChange.Actions | undefined>;
|
||||
extraConversationsForSend?: ReadonlyArray<string>;
|
||||
inviteLinkPassword?: string;
|
||||
name: string;
|
||||
syncMessageOnly?: boolean;
|
||||
}): Promise<void> {
|
||||
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();
|
||||
|
|
|
@ -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 () => {
|
||||
|
|
Loading…
Reference in a new issue