From 5ec78374d19d431ce9377fdb6ad3f08655f6de4b Mon Sep 17 00:00:00 2001 From: Josh Perez <60019601+josh-signal@users.noreply.github.com> Date: Wed, 17 Aug 2022 13:56:41 -0400 Subject: [PATCH] Use just the timestamp for story expiration --- ts/models/messages.ts | 8 +------- ts/services/storyLoader.ts | 5 +---- ts/textsecure/MessageReceiver.ts | 6 ++---- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/ts/models/messages.ts b/ts/models/messages.ts index b6f28f57d01..7512c2f2304 100644 --- a/ts/models/messages.ts +++ b/ts/models/messages.ts @@ -3042,13 +3042,7 @@ export class MessageModel extends window.Backbone.Model { } if (!message.get('expirationStartTimestamp')) { - message.set( - 'expirationStartTimestamp', - Math.min( - message.get('serverTimestamp') || message.get('timestamp'), - Date.now() - ) - ); + message.set('expirationStartTimestamp', message.get('timestamp')); changed = true; } } diff --git a/ts/services/storyLoader.ts b/ts/services/storyLoader.ts index 30733e6b944..00056f4851f 100644 --- a/ts/services/storyLoader.ts +++ b/ts/services/storyLoader.ts @@ -80,10 +80,7 @@ async function repairUnexpiredStories(): Promise { ) .map(story => ({ ...story, - expirationStartTimestamp: Math.min( - story.serverTimestamp || story.timestamp, - Date.now() - ), + expirationStartTimestamp: Math.min(story.timestamp, Date.now()), expireTimer: Math.min( Math.floor((story.timestamp + durations.DAY - Date.now()) / 1000), DAY_AS_SECONDS diff --git a/ts/textsecure/MessageReceiver.ts b/ts/textsecure/MessageReceiver.ts index bc5cf1de0d9..7ce78790cf5 100644 --- a/ts/textsecure/MessageReceiver.ts +++ b/ts/textsecure/MessageReceiver.ts @@ -1949,9 +1949,7 @@ export default class MessageReceiver } const expireTimer = Math.min( - Math.floor( - (envelope.serverTimestamp + durations.DAY - Date.now()) / 1000 - ), + Math.floor((envelope.timestamp + durations.DAY - Date.now()) / 1000), durations.DAY / 1000 ); @@ -1964,7 +1962,7 @@ export default class MessageReceiver return; } - const message = { + const message: ProcessedDataMessage = { attachments, canReplyToStory: Boolean(msg.allowsReplies), expireTimer,