Deprecate check for versioned expire timer capability
Co-authored-by: ayumi-signal <143036029+ayumi-signal@users.noreply.github.com>
This commit is contained in:
parent
8edb054874
commit
fa31d718bd
5 changed files with 3 additions and 106 deletions
|
@ -5383,7 +5383,7 @@ export class ConversationModel extends window.Backbone
|
||||||
if (!isDirectConversation(this.attributes)) {
|
if (!isDirectConversation(this.attributes)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const { expireTimerVersion, capabilities } = this.attributes;
|
const { expireTimerVersion } = this.attributes;
|
||||||
|
|
||||||
// This should not happen in practice, but be ready to handle
|
// This should not happen in practice, but be ready to handle
|
||||||
if (expireTimerVersion >= MAX_EXPIRE_TIMER_VERSION) {
|
if (expireTimerVersion >= MAX_EXPIRE_TIMER_VERSION) {
|
||||||
|
@ -5391,22 +5391,6 @@ export class ConversationModel extends window.Backbone
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (expireTimerVersion <= 2) {
|
|
||||||
if (!capabilities?.versionedExpirationTimer) {
|
|
||||||
log.warn(`${logId}: missing recipient capability`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const me = window.ConversationController.getOurConversationOrThrow();
|
|
||||||
if (!me.get('capabilities')?.versionedExpirationTimer) {
|
|
||||||
log.warn(`${logId}: missing sender capability`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Increment only if sender and receiver are both capable
|
|
||||||
} else {
|
|
||||||
// If we or them updated the timer version past 2 - we are both capable
|
|
||||||
}
|
|
||||||
|
|
||||||
const newVersion = expireTimerVersion + 1;
|
const newVersion = expireTimerVersion + 1;
|
||||||
this.set('expireTimerVersion', newVersion);
|
this.set('expireTimerVersion', newVersion);
|
||||||
await DataWriter.updateConversation(this.attributes);
|
await DataWriter.updateConversation(this.attributes);
|
||||||
|
|
|
@ -69,7 +69,6 @@ type JobType = {
|
||||||
|
|
||||||
const OBSERVED_CAPABILITY_KEYS = Object.keys({
|
const OBSERVED_CAPABILITY_KEYS = Object.keys({
|
||||||
deleteSync: true,
|
deleteSync: true,
|
||||||
versionedExpirationTimer: true,
|
|
||||||
ssre2: true,
|
ssre2: true,
|
||||||
} satisfies CapabilitiesType) as ReadonlyArray<keyof CapabilitiesType>;
|
} satisfies CapabilitiesType) as ReadonlyArray<keyof CapabilitiesType>;
|
||||||
|
|
||||||
|
|
|
@ -39,11 +39,7 @@ describe('messaging/expireTimerVersion', function (this: Mocha.Suite) {
|
||||||
bootstrap = new Bootstrap({ contactCount: 1 });
|
bootstrap = new Bootstrap({ contactCount: 1 });
|
||||||
await bootstrap.init();
|
await bootstrap.init();
|
||||||
|
|
||||||
const {
|
const { server, phone } = bootstrap;
|
||||||
server,
|
|
||||||
phone,
|
|
||||||
contacts: [contact],
|
|
||||||
} = bootstrap;
|
|
||||||
|
|
||||||
stranger = await server.createPrimaryDevice({
|
stranger = await server.createPrimaryDevice({
|
||||||
profileName: STRANGER_NAME,
|
profileName: STRANGER_NAME,
|
||||||
|
@ -62,17 +58,8 @@ describe('messaging/expireTimerVersion', function (this: Mocha.Suite) {
|
||||||
profileKey: stranger.profileKey.serialize(),
|
profileKey: stranger.profileKey.serialize(),
|
||||||
});
|
});
|
||||||
|
|
||||||
state = state.addContact(contact, {
|
|
||||||
identityState: Proto.ContactRecord.IdentityState.DEFAULT,
|
|
||||||
whitelisted: true,
|
|
||||||
serviceE164: undefined,
|
|
||||||
profileKey: contact.profileKey.serialize(),
|
|
||||||
});
|
|
||||||
contact.device.capabilities.versionedExpirationTimer = false;
|
|
||||||
|
|
||||||
// Put both contacts in left pane
|
// Put both contacts in left pane
|
||||||
state = state.pin(stranger);
|
state = state.pin(stranger);
|
||||||
state = state.pin(contact);
|
|
||||||
|
|
||||||
// Add my story
|
// Add my story
|
||||||
state = state.addRecord({
|
state = state.addRecord({
|
||||||
|
@ -277,78 +264,6 @@ describe('messaging/expireTimerVersion', function (this: Mocha.Suite) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
it('should not bump version for not capable recipient', async () => {
|
|
||||||
const {
|
|
||||||
contacts: [contact],
|
|
||||||
} = bootstrap;
|
|
||||||
|
|
||||||
const window = await app.getWindow();
|
|
||||||
const leftPane = window.locator('#LeftPane');
|
|
||||||
|
|
||||||
debug('opening conversation with the contact');
|
|
||||||
await leftPane
|
|
||||||
.locator(
|
|
||||||
`[data-testid="${contact.device.aci}"] >> "${contact.profileName}"`
|
|
||||||
)
|
|
||||||
.click();
|
|
||||||
|
|
||||||
await window.locator('.module-conversation-hero').waitFor();
|
|
||||||
|
|
||||||
const conversationStack = window.locator('.Inbox__conversation-stack');
|
|
||||||
|
|
||||||
debug('setting timer to 1 week');
|
|
||||||
await conversationStack
|
|
||||||
.locator('button.module-ConversationHeader__button--more')
|
|
||||||
.click();
|
|
||||||
|
|
||||||
await window
|
|
||||||
.locator('.react-contextmenu-item >> "Disappearing messages"')
|
|
||||||
.click();
|
|
||||||
|
|
||||||
await window
|
|
||||||
.locator(
|
|
||||||
'.module-ConversationHeader__disappearing-timer__item >> "1 week"'
|
|
||||||
)
|
|
||||||
.click();
|
|
||||||
|
|
||||||
debug('Getting first expiration update');
|
|
||||||
{
|
|
||||||
const { dataMessage } = await contact.waitForMessage();
|
|
||||||
assert.strictEqual(
|
|
||||||
dataMessage.flags,
|
|
||||||
Proto.DataMessage.Flags.EXPIRATION_TIMER_UPDATE
|
|
||||||
);
|
|
||||||
assert.strictEqual(dataMessage.expireTimer, 604800);
|
|
||||||
assert.strictEqual(dataMessage.expireTimerVersion, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
debug('setting timer to 4 weeks');
|
|
||||||
await conversationStack
|
|
||||||
.locator('button.module-ConversationHeader__button--more')
|
|
||||||
.click();
|
|
||||||
|
|
||||||
await window
|
|
||||||
.locator('.react-contextmenu-item >> "Disappearing messages"')
|
|
||||||
.click();
|
|
||||||
|
|
||||||
await window
|
|
||||||
.locator(
|
|
||||||
'.module-ConversationHeader__disappearing-timer__item >> "4 weeks"'
|
|
||||||
)
|
|
||||||
.click();
|
|
||||||
|
|
||||||
debug('Getting second expiration update');
|
|
||||||
{
|
|
||||||
const { dataMessage } = await contact.waitForMessage();
|
|
||||||
assert.strictEqual(
|
|
||||||
dataMessage.flags,
|
|
||||||
Proto.DataMessage.Flags.EXPIRATION_TIMER_UPDATE
|
|
||||||
);
|
|
||||||
assert.strictEqual(dataMessage.expireTimer, 2419200);
|
|
||||||
assert.strictEqual(dataMessage.expireTimerVersion, 1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should bump version for capable recipient', async () => {
|
it('should bump version for capable recipient', async () => {
|
||||||
const window = await app.getWindow();
|
const window = await app.getWindow();
|
||||||
const leftPane = window.locator('#LeftPane');
|
const leftPane = window.locator('#LeftPane');
|
||||||
|
|
|
@ -754,7 +754,6 @@ export type WebAPIConnectType = {
|
||||||
// ts/types/Storage.d.ts
|
// ts/types/Storage.d.ts
|
||||||
export type CapabilitiesType = {
|
export type CapabilitiesType = {
|
||||||
deleteSync: boolean;
|
deleteSync: boolean;
|
||||||
versionedExpirationTimer: boolean;
|
|
||||||
ssre2: boolean;
|
ssre2: boolean;
|
||||||
};
|
};
|
||||||
export type CapabilitiesUploadType = {
|
export type CapabilitiesUploadType = {
|
||||||
|
|
2
ts/types/Storage.d.ts
vendored
2
ts/types/Storage.d.ts
vendored
|
@ -190,7 +190,6 @@ export type StorageAccessType = {
|
||||||
needOrphanedAttachmentCheck: boolean;
|
needOrphanedAttachmentCheck: boolean;
|
||||||
observedCapabilities: {
|
observedCapabilities: {
|
||||||
deleteSync?: true;
|
deleteSync?: true;
|
||||||
versionedExpirationTimer?: true;
|
|
||||||
ssre2?: true;
|
ssre2?: true;
|
||||||
|
|
||||||
// Note: Upon capability deprecation - change the value type to `never` and
|
// Note: Upon capability deprecation - change the value type to `never` and
|
||||||
|
@ -223,6 +222,7 @@ export type StorageAccessType = {
|
||||||
formattingWarningShown: never;
|
formattingWarningShown: never;
|
||||||
hasRegisterSupportForUnauthenticatedDelivery: never;
|
hasRegisterSupportForUnauthenticatedDelivery: never;
|
||||||
masterKeyLastRequestTime: never;
|
masterKeyLastRequestTime: never;
|
||||||
|
versionedExpirationTimer: never;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type StorageInterface = {
|
export type StorageInterface = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue