diff --git a/ts/textsecure/MessageReceiver.ts b/ts/textsecure/MessageReceiver.ts index da00c99263af..b875ca1b1614 100644 --- a/ts/textsecure/MessageReceiver.ts +++ b/ts/textsecure/MessageReceiver.ts @@ -2390,9 +2390,9 @@ export default class MessageReceiver } // Timing check - if (isOlderThan(envelope.serverTimestamp, durations.DAY)) { + if (isOlderThan(envelope.serverTimestamp, durations.DAY * 2)) { log.info( - 'MessageReceiver.handleEditMessage: cannot edit message older than 24h', + 'MessageReceiver.handleEditMessage: cannot edit message older than 48h', logId, envelope.serverTimestamp ); diff --git a/ts/util/canEditMessage.ts b/ts/util/canEditMessage.ts index 67235a08157b..65548c418575 100644 --- a/ts/util/canEditMessage.ts +++ b/ts/util/canEditMessage.ts @@ -2,21 +2,20 @@ // SPDX-License-Identifier: AGPL-3.0-only import type { MessageAttributesType } from '../model-types.d'; -import { HOUR } from './durations'; +import { DAY } from './durations'; import { canEditMessages } from './canEditMessages'; import { isMoreRecentThan } from './timestamp'; import { isOutgoing } from '../messages/helpers'; import { isSent, someSendStatus } from '../messages/MessageSendState'; const MAX_EDIT_COUNT = 10; -const THREE_HOURS = 3 * HOUR; export function canEditMessage(message: MessageAttributesType): boolean { const result = canEditMessages() && !message.deletedForEveryone && isOutgoing(message) && - isMoreRecentThan(message.sent_at, THREE_HOURS) && + isMoreRecentThan(message.sent_at, DAY) && (message.editHistory?.length ?? 0) <= MAX_EDIT_COUNT && someSendStatus(message.sendStateByConversationId, isSent) && Boolean(message.body); diff --git a/ts/util/deleteForEveryone.ts b/ts/util/deleteForEveryone.ts index ce77b4b36437..e4d5242a9fdc 100644 --- a/ts/util/deleteForEveryone.ts +++ b/ts/util/deleteForEveryone.ts @@ -66,5 +66,5 @@ function isDeletionTooOld( const messageTimestamp = message.get('serverTimestamp') || message.get('sent_at') || 0; const delta = Math.abs(doe.serverTimestamp - messageTimestamp); - return delta > DAY; + return delta > DAY * 2; } diff --git a/ts/util/handleEditMessage.ts b/ts/util/handleEditMessage.ts index 88dbe5e9861b..15847bebd2aa 100644 --- a/ts/util/handleEditMessage.ts +++ b/ts/util/handleEditMessage.ts @@ -84,9 +84,9 @@ export async function handleEditMessage( if ( serverTimestamp && !isNoteToSelf && - isOlderThan(serverTimestamp, durations.DAY) + isOlderThan(serverTimestamp, durations.DAY * 2) ) { - log.warn(`${idLog}: cannot edit message older than 24h`, serverTimestamp); + log.warn(`${idLog}: cannot edit message older than 48h`, serverTimestamp); return; }