Bump DOE timer from 3h to 24h
This commit is contained in:
parent
d7b53f3d27
commit
c892febdbc
4 changed files with 6 additions and 10 deletions
|
@ -118,7 +118,6 @@ const STICKER_SIZE = 200;
|
|||
const GIF_SIZE = 300;
|
||||
// Note: this needs to match the animation time
|
||||
const TARGETED_TIMEOUT = 1200;
|
||||
const THREE_HOURS = 3 * 60 * 60 * 1000;
|
||||
const SENT_STATUSES = new Set<MessageStatusType>([
|
||||
'delivered',
|
||||
'read',
|
||||
|
@ -679,7 +678,7 @@ export class Message extends React.PureComponent<Props, State> {
|
|||
|
||||
private getTimeRemainingForDeleteForEveryone(): number {
|
||||
const { timestamp } = this.props;
|
||||
return Math.max(timestamp - Date.now() + THREE_HOURS, 0);
|
||||
return Math.max(timestamp - Date.now() + DAY, 0);
|
||||
}
|
||||
|
||||
private startDeleteForEveryoneTimerIfApplicable(): void {
|
||||
|
|
|
@ -116,7 +116,7 @@ import {
|
|||
} from '../../messages/MessageSendState';
|
||||
import * as log from '../../logging/log';
|
||||
import { getConversationColorAttributes } from '../../util/getConversationColorAttributes';
|
||||
import { DAY, HOUR, DurationInSeconds } from '../../util/durations';
|
||||
import { DAY, DurationInSeconds } from '../../util/durations';
|
||||
import { getStoryReplyText } from '../../util/getStoryReplyText';
|
||||
import type { MessageAttributesWithPaymentEvent } from '../../messages/helpers';
|
||||
import {
|
||||
|
@ -139,7 +139,6 @@ import { getCallIdFromEra } from '../../util/callDisposition';
|
|||
|
||||
export { isIncoming, isOutgoing, isStory };
|
||||
|
||||
const THREE_HOURS = 3 * HOUR;
|
||||
const linkify = LinkifyIt();
|
||||
|
||||
type FormattedContact = Partial<ConversationType> &
|
||||
|
@ -1842,7 +1841,7 @@ export function canDeleteForEveryone(
|
|||
// Has the message already been deleted?
|
||||
!message.deletedForEveryone &&
|
||||
// Is it too old to delete?
|
||||
isMoreRecentThan(message.sent_at, THREE_HOURS) &&
|
||||
isMoreRecentThan(message.sent_at, DAY) &&
|
||||
// Is it sent to anyone?
|
||||
someSendStatus(message.sendStateByConversationId, isSent)
|
||||
);
|
||||
|
|
|
@ -100,7 +100,7 @@ describe('state/selectors/messages', () => {
|
|||
it('returns false for messages that were are too old to delete', () => {
|
||||
const message = {
|
||||
type: 'outgoing' as const,
|
||||
sent_at: Date.now() - moment.duration(4, 'hours').asMilliseconds(),
|
||||
sent_at: Date.now() - moment.duration(25, 'hours').asMilliseconds(),
|
||||
sendStateByConversationId: {
|
||||
[ourConversationId]: {
|
||||
status: SendStatus.Read,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
import type { ConversationAttributesType } from '../model-types.d';
|
||||
import type { ConversationQueueJobData } from '../jobs/conversationJobQueue';
|
||||
import * as Errors from '../types/errors';
|
||||
import * as durations from './durations';
|
||||
import { DAY } from './durations';
|
||||
import * as log from '../logging/log';
|
||||
import {
|
||||
conversationJobQueue,
|
||||
|
@ -20,8 +20,6 @@ import { getRecipientConversationIds } from './getRecipientConversationIds';
|
|||
import { getRecipients } from './getRecipients';
|
||||
import { repeat, zipObject } from './iterables';
|
||||
|
||||
const THREE_HOURS = durations.HOUR * 3;
|
||||
|
||||
export async function sendDeleteForEveryoneMessage(
|
||||
conversationAttributes: ConversationAttributesType,
|
||||
options: {
|
||||
|
@ -42,7 +40,7 @@ export async function sendDeleteForEveryoneMessage(
|
|||
const idForLogging = getMessageIdForLogging(message.attributes);
|
||||
|
||||
const timestamp = Date.now();
|
||||
const maxDuration = deleteForEveryoneDuration || THREE_HOURS;
|
||||
const maxDuration = deleteForEveryoneDuration || DAY;
|
||||
if (timestamp - targetTimestamp > maxDuration) {
|
||||
throw new Error(`Cannot send DOE for a message older than ${maxDuration}`);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue