diff --git a/stylesheets/_session_conversation.scss b/stylesheets/_session_conversation.scss index 80a70a4f3..ea40c6ebe 100644 --- a/stylesheets/_session_conversation.scss +++ b/stylesheets/_session_conversation.scss @@ -27,6 +27,7 @@ transform: translateX(100%); will-change: transform; width: 25vw; + min-width: 350px; // because the disappear messages don't render well with less than this, and 25vw can be less than that z-index: 5; background-color: var(--background-primary-color); diff --git a/ts/components/buttons/PanelButton.tsx b/ts/components/buttons/PanelButton.tsx index d8fd31c81..a9a3f5100 100644 --- a/ts/components/buttons/PanelButton.tsx +++ b/ts/components/buttons/PanelButton.tsx @@ -89,7 +89,7 @@ export type PanelButtonProps = { disabled?: boolean; children: ReactNode; onClick: (...args: Array) => void; - dataTestId?: string; + dataTestId: string; style?: CSSProperties; }; diff --git a/ts/components/conversation/right-panel/overlay/OverlayRightPanelSettings.tsx b/ts/components/conversation/right-panel/overlay/OverlayRightPanelSettings.tsx index cd96706e0..e1e09931b 100644 --- a/ts/components/conversation/right-panel/overlay/OverlayRightPanelSettings.tsx +++ b/ts/components/conversation/right-panel/overlay/OverlayRightPanelSettings.tsx @@ -302,6 +302,7 @@ export const OverlayRightPanelSettings = () => { )} + {showUpdateGroupNameButton && ( { {window.i18n('groupMembers')} )} + + {hasDisappearingMessages && ( /* TODO Move ButtonGroup around all settings items */ @@ -354,6 +357,7 @@ export const OverlayRightPanelSettings = () => { { dispatch(setRightOverlayMode('disappearing-messages')); }} diff --git a/ts/components/conversation/right-panel/overlay/disappearing-messages/TimeOptions.tsx b/ts/components/conversation/right-panel/overlay/disappearing-messages/TimeOptions.tsx index 9590447c4..d7600a113 100644 --- a/ts/components/conversation/right-panel/overlay/disappearing-messages/TimeOptions.tsx +++ b/ts/components/conversation/right-panel/overlay/disappearing-messages/TimeOptions.tsx @@ -34,7 +34,7 @@ export const TimeOptions = (props: TimerOptionsProps) => { setSelected(option.value); }} disabled={disabled} - dataTestId={`disappear-time-${option.value}-option`} + dataTestId={option.name.replace(' ', '-')} // we want just "1-minute", etc as accessibility id /> ); })} diff --git a/ts/session/apis/open_group_api/sogsv3/sogsV3ClearInbox.ts b/ts/session/apis/open_group_api/sogsv3/sogsV3ClearInbox.ts index dc17e30a4..6adc1288c 100644 --- a/ts/session/apis/open_group_api/sogsv3/sogsV3ClearInbox.ts +++ b/ts/session/apis/open_group_api/sogsv3/sogsV3ClearInbox.ts @@ -1,4 +1,5 @@ import AbortController from 'abort-controller'; +import { getConversationController } from '../../../conversations'; import { OpenGroupRequestCommonType } from '../opengroupV2/ApiUtil'; import { getOpenGroupV2ConversationId } from '../utils/OpenGroupUtils'; import { @@ -7,7 +8,6 @@ import { OpenGroupBatchRow, sogsBatchSend, } from './sogsV3BatchPoll'; -import { getConversationController } from '../../../conversations'; type OpenGroupClearInboxResponse = { deleted: number; @@ -21,42 +21,40 @@ export const clearInbox = async (roomInfos: OpenGroupRequestCommonType): Promise if (!conversation) { throw new Error(`clearInbox Matching conversation not found in db ${conversationId}`); - } else { - const options: Array = [ - { - type: 'inbox', - inbox: { - type: 'delete', - }, + } + const options: Array = [ + { + type: 'inbox', + inbox: { + type: 'delete', }, - ]; + }, + ]; - const result = await sogsBatchSend( - roomInfos.serverUrl, - new Set([roomInfos.roomId]), - new AbortController().signal, - options, - 'batch' - ); + const result = await sogsBatchSend( + roomInfos.serverUrl, + new Set([roomInfos.roomId]), + new AbortController().signal, + options, + 'batch' + ); - if (!result) { - throw new Error(`Could not clearInbox, res is invalid for ${conversationId}`); - } + if (!result) { + throw new Error(`Could not clearInbox, res is invalid for ${conversationId}`); + } - const rawMessage = - (result.body && (result.body[0].body as OpenGroupClearInboxResponse)) || null; - if (!rawMessage) { - throw new Error(`clearInbox parsing failed for ${conversationId}`); - } + const rawMessage = (result.body && (result.body[0].body as OpenGroupClearInboxResponse)) || null; + if (!rawMessage) { + throw new Error(`clearInbox parsing failed for ${conversationId}`); + } - try { - if (batchGlobalIsSuccess(result) && batchFirstSubIsSuccess(result)) { - success = true; - window.log.info(`clearInbox ${rawMessage.deleted} messages deleted for ${conversationId} `); - } - } catch (e) { - window?.log?.error(`clearInbox Can't decode JSON body for ${conversationId}`); + try { + if (batchGlobalIsSuccess(result) && batchFirstSubIsSuccess(result)) { + success = true; + window.log.info(`clearInbox ${rawMessage.deleted} messages deleted for ${conversationId} `); } + } catch (e) { + window?.log?.error(`clearInbox Can't decode JSON body for ${conversationId}`); } if (!success) { diff --git a/ts/session/messages/outgoing/controlMessage/DataExtractionNotificationMessage.ts b/ts/session/messages/outgoing/controlMessage/DataExtractionNotificationMessage.ts index 50bf298bc..a0e785433 100644 --- a/ts/session/messages/outgoing/controlMessage/DataExtractionNotificationMessage.ts +++ b/ts/session/messages/outgoing/controlMessage/DataExtractionNotificationMessage.ts @@ -1,15 +1,13 @@ import { v4 as uuid } from 'uuid'; -import { SignalService } from '../../../../protobuf'; -import { MessageParams } from '../Message'; import { ContentMessage } from '..'; -import { PubKey } from '../../../types'; import { getMessageQueue } from '../../..'; +import { SignalService } from '../../../../protobuf'; +import { SnodeNamespaces } from '../../../apis/snode_api/namespaces'; import { getConversationController } from '../../../conversations'; +import { PubKey } from '../../../types'; import { UserUtils } from '../../../utils'; -import { SettingsKey } from '../../../../data/settings-key'; -import { Storage } from '../../../../util/storage'; -import { SnodeNamespaces } from '../../../apis/snode_api/namespaces'; +import { MessageParams } from '../Message'; interface DataExtractionNotificationMessageParams extends MessageParams { referencedAttachmentTimestamp: number; @@ -54,13 +52,7 @@ export const sendDataExtractionNotification = async ( referencedAttachmentTimestamp: number ) => { const convo = getConversationController().get(conversationId); - if ( - !convo || - !convo.isPrivate() || - convo.isMe() || - UserUtils.isUsFromCache(attachmentSender) || - !Storage.get(SettingsKey.settingsReadReceipt) - ) { + if (!convo || !convo.isPrivate() || convo.isMe() || UserUtils.isUsFromCache(attachmentSender)) { window.log.warn('Not sending saving attachment notification for', attachmentSender); return; } diff --git a/ts/session/utils/calling/CallManager.ts b/ts/session/utils/calling/CallManager.ts index 49fba9473..5fb782140 100644 --- a/ts/session/utils/calling/CallManager.ts +++ b/ts/session/utils/calling/CallManager.ts @@ -524,7 +524,11 @@ export async function USER_callRecipient(recipient: string) { expirationMode ); - if (expirationMode === 'legacy' || expirationMode === 'deleteAfterSend') { + if ( + expirationMode === 'legacy' || + expirationMode === 'deleteAfterSend' || + expirationMode === 'deleteAfterRead' // we are the one iniating the call, so that message is already read + ) { expirationStartTimestamp = DisappearingMessages.setExpirationStartTimestamp( expirationMode, now, diff --git a/ts/util/releaseFeature.ts b/ts/util/releaseFeature.ts index 88eb32bab..4acf60c4d 100644 --- a/ts/util/releaseFeature.ts +++ b/ts/util/releaseFeature.ts @@ -100,7 +100,10 @@ async function checkIsUserConfigFeatureReleased() { } async function checkIsDisappearMessageV2FeatureReleased() { - return checkIsFeatureReleased('disappearing_messages'); + return ( + (await checkIsFeatureReleased('disappearing_messages')) || + !!process.env.MULTI?.toLocaleLowerCase().includes('disappear_v2') // FIXME to remove after QA + ); } function isUserConfigFeatureReleasedCached(): boolean { @@ -109,7 +112,10 @@ function isUserConfigFeatureReleasedCached(): boolean { // NOTE Make sure to call checkIsDisappearMessageV2FeatureReleased at least once and then use this. It's mostly used in components that are rendered where we don't want to do async calls function isDisappearMessageV2FeatureReleasedCached(): boolean { - return !!isDisappearingMessageFeatureReleased; + return ( + !!isDisappearingMessageFeatureReleased || + !!process.env.MULTI?.toLocaleLowerCase().includes('disappear_v2') // FIXME to remove after QA + ); } export const ReleasedFeatures = { @@ -118,12 +124,3 @@ export const ReleasedFeatures = { isUserConfigFeatureReleasedCached, isDisappearMessageV2FeatureReleasedCached, }; - -// TODO DO NOT MERGE Remove after QA -async function setIsFeatureReleased(featureName: FeatureNameTracked, value: boolean) { - await Storage.put(featureStorageItemId(featureName), value); - setIsFeatureReleasedCached(featureName, value); - window.log.debug(`WIP: [releaseFeature]: ${featureName} ${value}`); -} - -window.setIsFeatureReleased = setIsFeatureReleased; diff --git a/ts/window.d.ts b/ts/window.d.ts index f42703884..2e5da8494 100644 --- a/ts/window.d.ts +++ b/ts/window.d.ts @@ -5,7 +5,6 @@ import { LocalizerType } from './types/Util'; import { ConversationCollection } from './models/conversation'; import { PrimaryColorStateType, ThemeStateType } from './themes/constants/colors'; -import { FeatureNameTracked } from './util/releaseFeature'; export interface LibTextsecure { messaging: boolean; @@ -105,8 +104,6 @@ declare global { setAutoUpdateEnabled: (enabled: boolean) => void; setZoomFactor: (newZoom: number) => void; updateZoomFactor: () => void; - // TODO DO NOT MERGE Remove after QA - setIsFeatureReleased: (featureName: FeatureNameTracked, value: boolean) => Promise; Signal: any; }