diff --git a/ts/models/conversations.ts b/ts/models/conversations.ts index 1dbf4a37ba5..f2283d8ecc5 100644 --- a/ts/models/conversations.ts +++ b/ts/models/conversations.ts @@ -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); diff --git a/ts/services/profiles.ts b/ts/services/profiles.ts index c5f5a2a7335..7630afe3ca5 100644 --- a/ts/services/profiles.ts +++ b/ts/services/profiles.ts @@ -69,7 +69,6 @@ type JobType = { const OBSERVED_CAPABILITY_KEYS = Object.keys({ deleteSync: true, - versionedExpirationTimer: true, ssre2: true, } satisfies CapabilitiesType) as ReadonlyArray; diff --git a/ts/test-mock/messaging/expire_timer_version_test.ts b/ts/test-mock/messaging/expire_timer_version_test.ts index fceaecd31cf..bef0518c8ba 100644 --- a/ts/test-mock/messaging/expire_timer_version_test.ts +++ b/ts/test-mock/messaging/expire_timer_version_test.ts @@ -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'); diff --git a/ts/textsecure/WebAPI.ts b/ts/textsecure/WebAPI.ts index d49b5fc591a..e6c7c9c8259 100644 --- a/ts/textsecure/WebAPI.ts +++ b/ts/textsecure/WebAPI.ts @@ -754,7 +754,6 @@ export type WebAPIConnectType = { // ts/types/Storage.d.ts export type CapabilitiesType = { deleteSync: boolean; - versionedExpirationTimer: boolean; ssre2: boolean; }; export type CapabilitiesUploadType = { diff --git a/ts/types/Storage.d.ts b/ts/types/Storage.d.ts index f4bb5a774d1..aabfcb4cbcc 100644 --- a/ts/types/Storage.d.ts +++ b/ts/types/Storage.d.ts @@ -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 = {