mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-02-14 23:18:54 +00:00
Fix backup group update test cases
This commit is contained in:
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -234,7 +234,7 @@ jobs:
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
||||
with:
|
||||
repository: 'signalapp/Signal-Message-Backup-Tests'
|
||||
ref: '279370b21fd089956a581c3b027489594135998a'
|
||||
ref: 'ae41153c5ac776b138b778b82fa593be23b3a14c'
|
||||
path: 'backup-integration-tests'
|
||||
|
||||
- run: xvfb-run --auto-servernum pnpm run test-electron
|
||||
|
||||
@@ -1744,9 +1744,6 @@ export class BackupExportStream extends Readable {
|
||||
|
||||
if (isGroupV2Change(message)) {
|
||||
updateMessage.groupChange = await this.toGroupV2Update(message, options);
|
||||
strictAssert(this.#ourConversation?.id, 'our conversation must exist');
|
||||
patch.authorId = this.#getOrPushPrivateRecipient(this.#ourConversation);
|
||||
|
||||
return { kind: NonBubbleResultKind.Directionless, patch };
|
||||
}
|
||||
|
||||
@@ -1995,14 +1992,7 @@ export class BackupExportStream extends Readable {
|
||||
groupChatUpdate.updates.push(container);
|
||||
addedItem = true;
|
||||
}
|
||||
if (droppedMemberCount > 0) {
|
||||
const container = new Backups.GroupChangeChatUpdate.Update();
|
||||
const update = new Backups.GroupV2MigrationDroppedMembersUpdate();
|
||||
update.droppedMembersCount = droppedMemberCount;
|
||||
container.groupV2MigrationDroppedMembersUpdate = update;
|
||||
groupChatUpdate.updates.push(container);
|
||||
addedItem = true;
|
||||
}
|
||||
|
||||
if (invitedMemberCount > 0) {
|
||||
const container = new Backups.GroupChangeChatUpdate.Update();
|
||||
const update = new Backups.GroupV2MigrationInvitedMembersUpdate();
|
||||
@@ -2012,6 +2002,15 @@ export class BackupExportStream extends Readable {
|
||||
addedItem = true;
|
||||
}
|
||||
|
||||
if (droppedMemberCount > 0) {
|
||||
const container = new Backups.GroupChangeChatUpdate.Update();
|
||||
const update = new Backups.GroupV2MigrationDroppedMembersUpdate();
|
||||
update.droppedMembersCount = droppedMemberCount;
|
||||
container.groupV2MigrationDroppedMembersUpdate = update;
|
||||
groupChatUpdate.updates.push(container);
|
||||
addedItem = true;
|
||||
}
|
||||
|
||||
if (!addedItem) {
|
||||
const container = new Backups.GroupChangeChatUpdate.Update();
|
||||
container.groupV2MigrationUpdate = new Backups.GroupV2MigrationUpdate();
|
||||
@@ -2301,7 +2300,7 @@ export class BackupExportStream extends Readable {
|
||||
update.groupUnknownInviteeUpdate = innerUpdate;
|
||||
updates.push(update);
|
||||
} else if (type === 'pending-remove-one') {
|
||||
if (from && detail.serviceId && from === detail.serviceId) {
|
||||
if ((from && from === detail.serviceId) || detail.serviceId == null) {
|
||||
const innerUpdate = new Backups.GroupInvitationDeclinedUpdate();
|
||||
if (detail.inviter) {
|
||||
innerUpdate.inviterAci = this.#aciToBytes(detail.inviter);
|
||||
@@ -2334,6 +2333,9 @@ export class BackupExportStream extends Readable {
|
||||
}
|
||||
innerUpdate.invitees = [
|
||||
{
|
||||
inviterAci: isAciString(detail.inviter)
|
||||
? this.#aciToBytes(detail.inviter)
|
||||
: undefined,
|
||||
inviteeAci: isAciString(detail.serviceId)
|
||||
? this.#aciToBytes(detail.serviceId)
|
||||
: undefined,
|
||||
|
||||
@@ -3054,6 +3054,12 @@ export class BackupImportStream extends Writable {
|
||||
`${logId}: groupInvitationRevokedUpdate had missing invitees list!`
|
||||
);
|
||||
}
|
||||
const firstInviter = invitees[0].inviterAci;
|
||||
const inviterAci =
|
||||
firstInviter &&
|
||||
invitees.every(invitee => invitee.inviterAci === firstInviter)
|
||||
? fromAciObject(Aci.fromUuidBytes(firstInviter))
|
||||
: undefined;
|
||||
|
||||
if (invitees.length === 1) {
|
||||
const { inviteeAci, inviteePni } = invitees[0];
|
||||
@@ -3071,17 +3077,20 @@ export class BackupImportStream extends Writable {
|
||||
details.push({
|
||||
type: 'pending-remove-one',
|
||||
serviceId,
|
||||
inviter: inviterAci,
|
||||
});
|
||||
} else {
|
||||
details.push({
|
||||
type: 'pending-remove-many',
|
||||
count: 1,
|
||||
inviter: inviterAci,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
details.push({
|
||||
type: 'pending-remove-many',
|
||||
count: invitees.length,
|
||||
inviter: inviterAci,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user