Deprecate check for versioned expire timer capability
This commit is contained in:
parent
1dea35043d
commit
a2bbfd9496
5 changed files with 3 additions and 106 deletions
|
@ -5383,7 +5383,7 @@ export class ConversationModel extends window.Backbone
|
|||
if (!isDirectConversation(this.attributes)) {
|
||||
return;
|
||||
}
|
||||
const { expireTimerVersion, capabilities } = this.attributes;
|
||||
const { expireTimerVersion } = this.attributes;
|
||||
|
||||
// This should not happen in practice, but be ready to handle
|
||||
if (expireTimerVersion >= MAX_EXPIRE_TIMER_VERSION) {
|
||||
|
@ -5391,22 +5391,6 @@ export class ConversationModel extends window.Backbone
|
|||
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;
|
||||
this.set('expireTimerVersion', newVersion);
|
||||
await DataWriter.updateConversation(this.attributes);
|
||||
|
|
|
@ -69,7 +69,6 @@ type JobType = {
|
|||
|
||||
const OBSERVED_CAPABILITY_KEYS = Object.keys({
|
||||
deleteSync: true,
|
||||
versionedExpirationTimer: true,
|
||||
ssre2: true,
|
||||
} satisfies CapabilitiesType) as ReadonlyArray<keyof CapabilitiesType>;
|
||||
|
||||
|
|
|
@ -39,11 +39,7 @@ describe('messaging/expireTimerVersion', function (this: Mocha.Suite) {
|
|||
bootstrap = new Bootstrap({ contactCount: 1 });
|
||||
await bootstrap.init();
|
||||
|
||||
const {
|
||||
server,
|
||||
phone,
|
||||
contacts: [contact],
|
||||
} = bootstrap;
|
||||
const { server, phone } = bootstrap;
|
||||
|
||||
stranger = await server.createPrimaryDevice({
|
||||
profileName: STRANGER_NAME,
|
||||
|
@ -62,17 +58,8 @@ describe('messaging/expireTimerVersion', function (this: Mocha.Suite) {
|
|||
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
|
||||
state = state.pin(stranger);
|
||||
state = state.pin(contact);
|
||||
|
||||
// Add my story
|
||||
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 () => {
|
||||
const window = await app.getWindow();
|
||||
const leftPane = window.locator('#LeftPane');
|
||||
|
|
|
@ -754,7 +754,6 @@ export type WebAPIConnectType = {
|
|||
// ts/types/Storage.d.ts
|
||||
export type CapabilitiesType = {
|
||||
deleteSync: boolean;
|
||||
versionedExpirationTimer: boolean;
|
||||
ssre2: boolean;
|
||||
};
|
||||
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;
|
||||
observedCapabilities: {
|
||||
deleteSync?: true;
|
||||
versionedExpirationTimer?: true;
|
||||
ssre2?: true;
|
||||
|
||||
// Note: Upon capability deprecation - change the value type to `never` and
|
||||
|
@ -223,6 +222,7 @@ export type StorageAccessType = {
|
|||
formattingWarningShown: never;
|
||||
hasRegisterSupportForUnauthenticatedDelivery: never;
|
||||
masterKeyLastRequestTime: never;
|
||||
versionedExpirationTimer: never;
|
||||
};
|
||||
|
||||
export type StorageInterface = {
|
||||
|
|
Loading…
Add table
Reference in a new issue