Bump up the edit send/receive timers to 24hr/48hr
This commit is contained in:
parent
0459ab02d3
commit
cc13350d3f
4 changed files with 7 additions and 8 deletions
|
@ -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
|
||||
);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue