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,
|
extraConversationsForSend,
|
||||||
inviteLinkPassword,
|
inviteLinkPassword,
|
||||||
name,
|
name,
|
||||||
|
syncMessageOnly = false,
|
||||||
}: {
|
}: {
|
||||||
conversation: ConversationModel;
|
conversation: ConversationModel;
|
||||||
usingCredentialsFrom: ReadonlyArray<ConversationModel>;
|
usingCredentialsFrom: ReadonlyArray<ConversationModel>;
|
||||||
|
@ -1462,6 +1463,7 @@ export async function modifyGroupV2({
|
||||||
extraConversationsForSend?: ReadonlyArray<string>;
|
extraConversationsForSend?: ReadonlyArray<string>;
|
||||||
inviteLinkPassword?: string;
|
inviteLinkPassword?: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
syncMessageOnly?: boolean;
|
||||||
}): Promise<void> {
|
}): Promise<void> {
|
||||||
const logId = `${name}/${conversation.idForLogging()}`;
|
const logId = `${name}/${conversation.idForLogging()}`;
|
||||||
|
|
||||||
|
@ -1561,7 +1563,7 @@ export async function modifyGroupV2({
|
||||||
type: conversationQueueJobEnum.enum.GroupUpdate,
|
type: conversationQueueJobEnum.enum.GroupUpdate,
|
||||||
conversationId: conversation.id,
|
conversationId: conversation.id,
|
||||||
groupChangeBase64,
|
groupChangeBase64,
|
||||||
recipients: groupV2Info.members.slice(),
|
recipients: syncMessageOnly ? [] : groupV2Info.members.slice(),
|
||||||
revision: groupV2Info.revision,
|
revision: groupV2Info.revision,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -755,12 +755,14 @@ export class ConversationModel extends window.Backbone
|
||||||
extraConversationsForSend,
|
extraConversationsForSend,
|
||||||
inviteLinkPassword,
|
inviteLinkPassword,
|
||||||
name,
|
name,
|
||||||
|
syncMessageOnly,
|
||||||
}: {
|
}: {
|
||||||
usingCredentialsFrom: ReadonlyArray<ConversationModel>;
|
usingCredentialsFrom: ReadonlyArray<ConversationModel>;
|
||||||
createGroupChange: () => Promise<Proto.GroupChange.Actions | undefined>;
|
createGroupChange: () => Promise<Proto.GroupChange.Actions | undefined>;
|
||||||
extraConversationsForSend?: ReadonlyArray<string>;
|
extraConversationsForSend?: ReadonlyArray<string>;
|
||||||
inviteLinkPassword?: string;
|
inviteLinkPassword?: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
syncMessageOnly?: boolean;
|
||||||
}): Promise<void> {
|
}): Promise<void> {
|
||||||
await window.Signal.Groups.modifyGroupV2({
|
await window.Signal.Groups.modifyGroupV2({
|
||||||
conversation: this,
|
conversation: this,
|
||||||
|
@ -769,6 +771,7 @@ export class ConversationModel extends window.Backbone
|
||||||
extraConversationsForSend,
|
extraConversationsForSend,
|
||||||
inviteLinkPassword,
|
inviteLinkPassword,
|
||||||
name,
|
name,
|
||||||
|
syncMessageOnly,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2597,6 +2600,7 @@ export class ConversationModel extends window.Backbone
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
usingCredentialsFrom: [],
|
usingCredentialsFrom: [],
|
||||||
createGroupChange: () => this.removePendingMember([ourPNI]),
|
createGroupChange: () => this.removePendingMember([ourPNI]),
|
||||||
|
syncMessageOnly: true,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const logId = this.idForLogging();
|
const logId = this.idForLogging();
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import type { Group } from '@signalapp/mock-server';
|
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 createDebug from 'debug';
|
||||||
|
|
||||||
import * as durations from '../../util/durations';
|
import * as durations from '../../util/durations';
|
||||||
|
@ -159,6 +159,21 @@ describe('pnp/accept gv2 invite', function needsName() {
|
||||||
assert(!group.getMemberByUUID(desktop.pni));
|
assert(!group.getMemberByUUID(desktop.pni));
|
||||||
assert(!group.getPendingMemberByUUID(desktop.uuid));
|
assert(!group.getPendingMemberByUUID(desktop.uuid));
|
||||||
assert(!group.getPendingMemberByUUID(desktop.pni));
|
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 () => {
|
it('should accept ACI invite with extra PNI on the invite list', async () => {
|
||||||
|
|
Loading…
Reference in a new issue