From f5ddd586f6082042ba7c9807abe5bf4be94341cd Mon Sep 17 00:00:00 2001 From: Chewbacca Date: Wed, 9 Nov 2022 08:37:50 -0500 Subject: [PATCH] Add 2 minute deletion duration for testing --- .../chat-page/components/chat-page-main.tsx | 6 ++++++ app/soapbox/queries/chats.ts | 11 ++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/app/soapbox/features/chats/components/chat-page/components/chat-page-main.tsx b/app/soapbox/features/chats/components/chat-page/components/chat-page-main.tsx index 49d1331d2e..449a85a5b8 100644 --- a/app/soapbox/features/chats/components/chat-page/components/chat-page-main.tsx +++ b/app/soapbox/features/chats/components/chat-page/components/chat-page-main.tsx @@ -33,6 +33,7 @@ const messages = defineMessages({ leaveChat: { id: 'chat_settings.options.leave_chat', defaultMessage: 'Leave Chat' }, autoDeleteLabel: { id: 'chat_settings.auto_delete.label', defaultMessage: 'Auto-delete messages' }, autoDeleteHint: { id: 'chat_settings.auto_delete.hint', defaultMessage: 'Sent messages will auto-delete after the time period selected' }, + autoDelete2Minutes: { id: 'chat_settings.auto_delete.2minutes', defaultMessage: '2 minutes' }, autoDelete7Days: { id: 'chat_settings.auto_delete.7days', defaultMessage: '7 days' }, autoDelete14Days: { id: 'chat_settings.auto_delete.14days', defaultMessage: '14 days' }, autoDelete30Days: { id: 'chat_settings.auto_delete.30days', defaultMessage: '30 days' }, @@ -182,6 +183,11 @@ const ChatPageMain = () => { label={intl.formatMessage(messages.autoDeleteLabel)} hint={intl.formatMessage(messages.autoDeleteHint)} /> + handleUpdateChat(MessageExpirationValues.TWO_MINUTES)} + isSelected={chat.message_expiration === MessageExpirationValues.TWO_MINUTES} + /> handleUpdateChat(MessageExpirationValues.SEVEN)} diff --git a/app/soapbox/queries/chats.ts b/app/soapbox/queries/chats.ts index 1a496582ba..9601aa41ed 100644 --- a/app/soapbox/queries/chats.ts +++ b/app/soapbox/queries/chats.ts @@ -16,13 +16,14 @@ import { queryClient } from './client'; import type { IAccount } from './accounts'; -export const messageExpirationOptions = [604800, 1209600, 2592000, 7776000]; +export const messageExpirationOptions = [120, 604800, 1209600, 2592000, 7776000]; export enum MessageExpirationValues { - 'SEVEN' = messageExpirationOptions[0], - 'FOURTEEN' = messageExpirationOptions[1], - 'THIRTY' = messageExpirationOptions[2], - 'NINETY' = messageExpirationOptions[3] + 'TWO_MINUTES' = messageExpirationOptions[0], + 'SEVEN' = messageExpirationOptions[1], + 'FOURTEEN' = messageExpirationOptions[2], + 'THIRTY' = messageExpirationOptions[3], + 'NINETY' = messageExpirationOptions[4] } export interface IChat {