diff --git a/ts/models/message.ts b/ts/models/message.ts index 14814df25..9cb3c059c 100644 --- a/ts/models/message.ts +++ b/ts/models/message.ts @@ -1121,9 +1121,6 @@ export class MessageModel extends Backbone.Model { const expireTimer = this.get('expireTimer'); if (canBeDeleteAfterRead && expirationType && expireTimer > 0) { - window.log.debug( - `WIP: markMessageReadNoCommit ${this.idForLogging()} is deleteAfterRead starting expiration` - ); const expirationMode = changeToDisappearingMessageConversationType( convo, expirationType, @@ -1131,6 +1128,7 @@ export class MessageModel extends Backbone.Model { ); if (expirationMode === 'legacy' || expirationMode === 'deleteAfterRead') { + window.log.debug(`WIP: markMessageReadNoCommit setExpirationStartTimestamp is starting`); this.set({ expirationStartTimestamp: setExpirationStartTimestamp(expirationMode, readAt), }); diff --git a/ts/receiver/contentMessage.ts b/ts/receiver/contentMessage.ts index 8bf776029..f5f68b5aa 100644 --- a/ts/receiver/contentMessage.ts +++ b/ts/receiver/contentMessage.ts @@ -893,6 +893,8 @@ export async function handleDataExtractionNotification( ? changeToDisappearingMessageType(convo, expireTimer, expirationMode) : undefined; + // NOTE Trigger for an incoming message + // TODO legacy messages support will be removed in a future release if (expirationMode === 'legacy' || expirationMode === 'deleteAfterSend') { expirationStartTimestamp = setExpirationStartTimestamp(expirationMode); } diff --git a/ts/receiver/queuedJob.ts b/ts/receiver/queuedJob.ts index 48e41ee14..a0cf69fb4 100644 --- a/ts/receiver/queuedJob.ts +++ b/ts/receiver/queuedJob.ts @@ -180,6 +180,7 @@ function updateReadStatus(message: MessageModel) { if (message.isExpirationTimerUpdate()) { message.set({ unread: READ_MESSAGE_STATE.read }); const convo = message.getConversation(); + // TODO legacy messages support will be removed in a future release const canBeDeleteAfterRead = convo && !convo.isMe() && convo.isPrivate(); const expirationType = message.get('expirationType'); const expireTimer = message.get('expireTimer'); @@ -192,6 +193,7 @@ function updateReadStatus(message: MessageModel) { ); if (expirationMode === 'legacy' || expirationMode === 'deleteAfterRead') { + window.log.debug(`WIP: updateReadStatus setExpirationStartTimestamp is starting`); message.set({ expirationStartTimestamp: setExpirationStartTimestamp(expirationMode), }); @@ -410,12 +412,16 @@ export async function handleMessageJob( // source === UserUtils.getOurPubKeyStrFromCache() && // messageModel.get('type') === 'outgoing'; + // TODO legacy messages support will be removed in a future release + const canBeDeleteAfterSend = conversation && conversation.isMe() && conversation.isGroup(); + // TODO legacy support could be broken after V2 is released on a modern client on a 1-1 with disapearAfterRead if ( - expirationMode === 'legacy' || + (canBeDeleteAfterSend && expirationMode === 'legacy') || expirationMode === 'deleteAfterSend' // || // legacySyncMessageMustDisappearAfterRead ) { + window.log.debug(`WIP: handleMessageJob setExpirationStartTimestamp is starting`); messageModel.set({ expirationStartTimestamp: setExpirationStartTimestamp( expirationMode, diff --git a/ts/session/group/closed-group.ts b/ts/session/group/closed-group.ts index 4eacd0120..71699060d 100644 --- a/ts/session/group/closed-group.ts +++ b/ts/session/group/closed-group.ts @@ -184,6 +184,8 @@ export async function addUpdateMessage( ? changeToDisappearingMessageType(convo, convo.get('expireTimer'), expirationMode) : undefined; + // NOTE Trigger for an incoming message + // TODO legacy messages support will be removed in a future release if (expirationMode === 'legacy' || expirationMode === 'deleteAfterSend') { expirationStartTimestamp = setExpirationStartTimestamp(expirationMode, sentAt); } diff --git a/ts/session/sending/MessageSentHandler.ts b/ts/session/sending/MessageSentHandler.ts index 21ca6827e..87e2a83c8 100644 --- a/ts/session/sending/MessageSentHandler.ts +++ b/ts/session/sending/MessageSentHandler.ts @@ -146,8 +146,9 @@ async function handleMessageSentSuccess( expireTimer ); - // NOTE we treat all outbound disappearing messages as read as soon as they are sent. + // NOTE starting disappearing messages timer for all outbound messages if (expirationMode !== 'off') { + window.log.debug(`WIP: handleMessageSentSuccess setExpirationStartTimestamp is starting`); fetchedMessage.set({ expirationStartTimestamp: setExpirationStartTimestamp( expirationMode, diff --git a/ts/session/utils/calling/CallManager.ts b/ts/session/utils/calling/CallManager.ts index e5d26f721..f5ceeab37 100644 --- a/ts/session/utils/calling/CallManager.ts +++ b/ts/session/utils/calling/CallManager.ts @@ -522,6 +522,7 @@ export async function USER_callRecipient(recipient: string) { let expirationStartTimestamp; if (calledConvo && expirationMode && expireTimer > 0) { + // TODO legacy messages support will be removed in a future release expirationType = changeToDisappearingMessageType(calledConvo, expireTimer, expirationMode); if (expirationMode === 'legacy' || expirationMode === 'deleteAfterSend') { @@ -902,6 +903,7 @@ export async function USER_acceptIncomingCallRequest(fromSender: string) { let expirationStartTimestamp; if (callerConvo && expirationMode && expireTimer > 0) { + // TODO legacy messages support will be removed in a future release expirationType = changeToDisappearingMessageType(callerConvo, expireTimer, expirationMode); if (expirationMode === 'legacy' || expirationMode === 'deleteAfterSend') { @@ -1254,6 +1256,7 @@ async function addMissedCallMessage(callerPubkey: string, sentAt: number) { let expirationStartTimestamp; if (incomingCallConversation && expirationMode && expireTimer > 0) { + // TODO legacy messages support will be removed in a future release expirationType = changeToDisappearingMessageType( incomingCallConversation, expireTimer,