From 8872ccf7fed0994c6e05f1dd6634eeed308eba5e Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Mon, 23 Oct 2023 14:30:49 +1100 Subject: [PATCH 1/7] chore: disappear feature switch based on env variable for QA --- ts/util/releaseFeature.ts | 20 +++++++++----------- ts/window.d.ts | 3 --- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/ts/util/releaseFeature.ts b/ts/util/releaseFeature.ts index 88eb32bab..f81d691d3 100644 --- a/ts/util/releaseFeature.ts +++ b/ts/util/releaseFeature.ts @@ -1,3 +1,4 @@ +import { isEmpty } from 'lodash'; import { GetNetworkTime } from '../session/apis/snode_api/getNetworkTime'; import { FEATURE_RELEASE_TIMESTAMPS } from '../session/constants'; import { ConfigurationSync } from '../session/utils/job_runners/jobs/ConfigurationSyncJob'; @@ -100,7 +101,10 @@ async function checkIsUserConfigFeatureReleased() { } async function checkIsDisappearMessageV2FeatureReleased() { - return checkIsFeatureReleased('disappearing_messages'); + return ( + checkIsFeatureReleased('disappearing_messages') || + !isEmpty(process.env.SESSION_FORCE_DISAPPEAR_V2_ENABLED) // FIXME to remove after QA + ); } function isUserConfigFeatureReleasedCached(): boolean { @@ -109,7 +113,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 || + !isEmpty(process.env.SESSION_FORCE_DISAPPEAR_V2_ENABLED) // FIXME to remove after QA + ); } export const ReleasedFeatures = { @@ -118,12 +125,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; } From e6dd6844f966650f7c102c5c538fbfbda8550b30 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Mon, 23 Oct 2023 15:35:17 +1100 Subject: [PATCH 2/7] fix: move right panel buttons to a panelbuttongroup also enforce a 300 min width for the right panel, otherwise the bloaded disappearing message design is not looking good --- stylesheets/_session_conversation.scss | 1 + ts/components/buttons/PanelButton.tsx | 11 ++ ts/components/buttons/PanelIconButton.tsx | 5 +- .../overlay/OverlayRightPanelSettings.tsx | 106 +++++++----------- 4 files changed, 53 insertions(+), 70 deletions(-) diff --git a/stylesheets/_session_conversation.scss b/stylesheets/_session_conversation.scss index 80a70a4f3..a09024d73 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: 300px; // because the disappear messages don't render will with less than this, and 25% 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..6cd31dbf3 100644 --- a/ts/components/buttons/PanelButton.tsx +++ b/ts/components/buttons/PanelButton.tsx @@ -81,6 +81,17 @@ const StyledPanelButton = styled.button<{ :not(:last-child) { border-bottom: 1px solid var(--border-color); } + padding-top: var(--margins-lg); + padding-bottom: var(--margins-lg); + text-align: left; + + :first-child { + padding-top: 0; + } + + :last-child { + padding-bottom: 0; + } `; export type PanelButtonProps = { diff --git a/ts/components/buttons/PanelIconButton.tsx b/ts/components/buttons/PanelIconButton.tsx index 9059fac04..7f1be973b 100644 --- a/ts/components/buttons/PanelIconButton.tsx +++ b/ts/components/buttons/PanelIconButton.tsx @@ -1,9 +1,10 @@ import React from 'react'; +import { SpacerLG } from '../basic/Text'; import { SessionIcon, SessionIconType } from '../icon'; import { PanelButton, PanelButtonProps, StyledContent, StyledText } from './PanelButton'; interface PanelIconButton extends Omit { - iconType: SessionIconType; + iconType: SessionIconType | null; text: string; } @@ -13,7 +14,7 @@ export const PanelIconButton = (props: PanelIconButton) => { return ( - + {iconType ? : } {text} diff --git a/ts/components/conversation/right-panel/overlay/OverlayRightPanelSettings.tsx b/ts/components/conversation/right-panel/overlay/OverlayRightPanelSettings.tsx index cd96706e0..263fa6bb4 100644 --- a/ts/components/conversation/right-panel/overlay/OverlayRightPanelSettings.tsx +++ b/ts/components/conversation/right-panel/overlay/OverlayRightPanelSettings.tsx @@ -176,26 +176,6 @@ const StyledLeaveButton = styled.div` } `; -const StyledGroupSettingsItem = styled.div` - display: flex; - align-items: center; - min-height: 3rem; - font-size: var(--font-size-md); - color: var(--right-panel-item-text-color); - background-color: var(--right-panel-item-background-color); - border-top: 1px solid var(--border-color); - border-bottom: 1px solid var(--border-color); - - width: -webkit-fill-available; - padding: 0 var(--margins-md); - transition: var(--default-duration); - cursor: pointer; - - &:hover { - background-color: var(--right-panel-item-background-hover-color); - } -`; - const StyledName = styled.h4` padding-inline: var(--margins-md); font-size: var(--font-size-md); @@ -301,56 +281,47 @@ export const OverlayRightPanelSettings = () => { - )} - {showUpdateGroupNameButton && ( - { - void showUpdateGroupNameByConvoId(selectedConvoKey); - }} - > - {isPublic ? window.i18n('editGroup') : window.i18n('editGroupName')} - - )} - {showAddRemoveModeratorsButton && ( - <> - + {showUpdateGroupNameButton && ( + { - showAddModeratorsByConvoId(selectedConvoKey); + void showUpdateGroupNameByConvoId(selectedConvoKey); }} - > - {window.i18n('addModerators')} - - + )} + {showAddRemoveModeratorsButton && ( + <> + { + showAddModeratorsByConvoId(selectedConvoKey); + }} + text={window.i18n('addModerators')} + /> + { + showRemoveModeratorsByConvoId(selectedConvoKey); + }} + text={window.i18n('removeModerators')} + /> + + )} + + {showUpdateGroupMembersButton && ( + { - showRemoveModeratorsByConvoId(selectedConvoKey); + void showUpdateGroupMembersByConvoId(selectedConvoKey); }} - > - {window.i18n('removeModerators')} - - - )} - - {showUpdateGroupMembersButton && ( - { - void showUpdateGroupMembersByConvoId(selectedConvoKey); - }} - > - {window.i18n('groupMembers')} - - )} + text={window.i18n('groupMembers')} + /> + )} - {hasDisappearingMessages && ( - /* TODO Move ButtonGroup around all settings items */ - + {hasDisappearingMessages && ( { dispatch(setRightOverlayMode('disappearing-messages')); }} /> - - )} - + )} + {isGroup && ( From 9cc37cc0e749060c4d18578fd0a277ed31f5b5e3 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Mon, 23 Oct 2023 15:46:47 +1100 Subject: [PATCH 3/7] fix: outgoing start call notification timer start on after read --- ts/session/utils/calling/CallManager.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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, From f796c59cefc683585cbf8193431d2dfcfd2e3c9b Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Mon, 23 Oct 2023 16:33:00 +1100 Subject: [PATCH 4/7] chore: add missing accessibilityIds for menu buttons/radio --- stylesheets/_session_conversation.scss | 2 +- ts/components/buttons/PanelButton.tsx | 2 +- .../right-panel/overlay/OverlayRightPanelSettings.tsx | 7 ++++++- .../overlay/disappearing-messages/TimeOptions.tsx | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/stylesheets/_session_conversation.scss b/stylesheets/_session_conversation.scss index a09024d73..9b50aa63b 100644 --- a/stylesheets/_session_conversation.scss +++ b/stylesheets/_session_conversation.scss @@ -27,7 +27,7 @@ transform: translateX(100%); will-change: transform; width: 25vw; - min-width: 300px; // because the disappear messages don't render will with less than this, and 25% can be less than that + min-width: 300px; // 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 6cd31dbf3..e4644c0c0 100644 --- a/ts/components/buttons/PanelButton.tsx +++ b/ts/components/buttons/PanelButton.tsx @@ -100,7 +100,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 263fa6bb4..4fb93b780 100644 --- a/ts/components/conversation/right-panel/overlay/OverlayRightPanelSettings.tsx +++ b/ts/components/conversation/right-panel/overlay/OverlayRightPanelSettings.tsx @@ -281,7 +281,7 @@ export const OverlayRightPanelSettings = () => { - )}{' '} + )} {showUpdateGroupNameButton && ( { }} text={isPublic ? window.i18n('editGroup') : window.i18n('editGroupName')} iconType={null} + dataTestId="edit-group" /> )} {showAddRemoveModeratorsButton && ( @@ -300,6 +301,7 @@ export const OverlayRightPanelSettings = () => { showAddModeratorsByConvoId(selectedConvoKey); }} text={window.i18n('addModerators')} + dataTestId="add-moderators" /> { showRemoveModeratorsByConvoId(selectedConvoKey); }} text={window.i18n('removeModerators')} + dataTestId="remove-moderators" /> )} @@ -318,6 +321,7 @@ export const OverlayRightPanelSettings = () => { void showUpdateGroupMembersByConvoId(selectedConvoKey); }} text={window.i18n('groupMembers')} + dataTestId="group-members" /> )} @@ -325,6 +329,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 /> ); })} From 42ec7178518b504cf032f6f9ad3d8ef269eb87bb Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Mon, 23 Oct 2023 16:45:50 +1100 Subject: [PATCH 5/7] fix: send extraction notification even if read receipts is off --- .../DataExtractionNotificationMessage.ts | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) 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; } From 1a53f699b4ba8152442ba7089ec7f71ee844b2c8 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Mon, 23 Oct 2023 17:31:03 +1100 Subject: [PATCH 6/7] Revert "fix: move right panel buttons to a panelbuttongroup" This reverts commit e6dd6844f966650f7c102c5c538fbfbda8550b30. --- stylesheets/_session_conversation.scss | 2 +- ts/components/buttons/PanelButton.tsx | 11 -- ts/components/buttons/PanelIconButton.tsx | 5 +- .../overlay/OverlayRightPanelSettings.tsx | 111 +++++++++++------- ts/util/releaseFeature.ts | 2 +- 5 files changed, 74 insertions(+), 57 deletions(-) diff --git a/stylesheets/_session_conversation.scss b/stylesheets/_session_conversation.scss index 9b50aa63b..ea40c6ebe 100644 --- a/stylesheets/_session_conversation.scss +++ b/stylesheets/_session_conversation.scss @@ -27,7 +27,7 @@ transform: translateX(100%); will-change: transform; width: 25vw; - min-width: 300px; // because the disappear messages don't render well with less than this, and 25vw can be less than that + 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 e4644c0c0..a9a3f5100 100644 --- a/ts/components/buttons/PanelButton.tsx +++ b/ts/components/buttons/PanelButton.tsx @@ -81,17 +81,6 @@ const StyledPanelButton = styled.button<{ :not(:last-child) { border-bottom: 1px solid var(--border-color); } - padding-top: var(--margins-lg); - padding-bottom: var(--margins-lg); - text-align: left; - - :first-child { - padding-top: 0; - } - - :last-child { - padding-bottom: 0; - } `; export type PanelButtonProps = { diff --git a/ts/components/buttons/PanelIconButton.tsx b/ts/components/buttons/PanelIconButton.tsx index 7f1be973b..9059fac04 100644 --- a/ts/components/buttons/PanelIconButton.tsx +++ b/ts/components/buttons/PanelIconButton.tsx @@ -1,10 +1,9 @@ import React from 'react'; -import { SpacerLG } from '../basic/Text'; import { SessionIcon, SessionIconType } from '../icon'; import { PanelButton, PanelButtonProps, StyledContent, StyledText } from './PanelButton'; interface PanelIconButton extends Omit { - iconType: SessionIconType | null; + iconType: SessionIconType; text: string; } @@ -14,7 +13,7 @@ export const PanelIconButton = (props: PanelIconButton) => { return ( - {iconType ? : } + {text} diff --git a/ts/components/conversation/right-panel/overlay/OverlayRightPanelSettings.tsx b/ts/components/conversation/right-panel/overlay/OverlayRightPanelSettings.tsx index 4fb93b780..e1e09931b 100644 --- a/ts/components/conversation/right-panel/overlay/OverlayRightPanelSettings.tsx +++ b/ts/components/conversation/right-panel/overlay/OverlayRightPanelSettings.tsx @@ -176,6 +176,26 @@ const StyledLeaveButton = styled.div` } `; +const StyledGroupSettingsItem = styled.div` + display: flex; + align-items: center; + min-height: 3rem; + font-size: var(--font-size-md); + color: var(--right-panel-item-text-color); + background-color: var(--right-panel-item-background-color); + border-top: 1px solid var(--border-color); + border-bottom: 1px solid var(--border-color); + + width: -webkit-fill-available; + padding: 0 var(--margins-md); + transition: var(--default-duration); + cursor: pointer; + + &:hover { + background-color: var(--right-panel-item-background-hover-color); + } +`; + const StyledName = styled.h4` padding-inline: var(--margins-md); font-size: var(--font-size-md); @@ -282,50 +302,58 @@ export const OverlayRightPanelSettings = () => { )} - - {showUpdateGroupNameButton && ( - { + void showUpdateGroupNameByConvoId(selectedConvoKey); + }} + > + {isPublic ? window.i18n('editGroup') : window.i18n('editGroupName')} + + )} + {showAddRemoveModeratorsButton && ( + <> + { - void showUpdateGroupNameByConvoId(selectedConvoKey); + showAddModeratorsByConvoId(selectedConvoKey); }} - text={isPublic ? window.i18n('editGroup') : window.i18n('editGroupName')} - iconType={null} - dataTestId="edit-group" - /> - )} - {showAddRemoveModeratorsButton && ( - <> - { - showAddModeratorsByConvoId(selectedConvoKey); - }} - text={window.i18n('addModerators')} - dataTestId="add-moderators" - /> - { - showRemoveModeratorsByConvoId(selectedConvoKey); - }} - text={window.i18n('removeModerators')} - dataTestId="remove-moderators" - /> - - )} - - {showUpdateGroupMembersButton && ( - + {window.i18n('addModerators')} + + { - void showUpdateGroupMembersByConvoId(selectedConvoKey); + showRemoveModeratorsByConvoId(selectedConvoKey); }} - text={window.i18n('groupMembers')} - dataTestId="group-members" - /> - )} + > + {window.i18n('removeModerators')} + + + )} + + {showUpdateGroupMembersButton && ( + { + void showUpdateGroupMembersByConvoId(selectedConvoKey); + }} + > + {window.i18n('groupMembers')} + + )} + + - {hasDisappearingMessages && ( + {hasDisappearingMessages && ( + /* TODO Move ButtonGroup around all settings items */ + { dispatch(setRightOverlayMode('disappearing-messages')); }} /> - )} - + + )} + {isGroup && ( diff --git a/ts/util/releaseFeature.ts b/ts/util/releaseFeature.ts index f81d691d3..e415c3e14 100644 --- a/ts/util/releaseFeature.ts +++ b/ts/util/releaseFeature.ts @@ -102,7 +102,7 @@ async function checkIsUserConfigFeatureReleased() { async function checkIsDisappearMessageV2FeatureReleased() { return ( - checkIsFeatureReleased('disappearing_messages') || + (await checkIsFeatureReleased('disappearing_messages')) || !isEmpty(process.env.SESSION_FORCE_DISAPPEAR_V2_ENABLED) // FIXME to remove after QA ); } From 45e118ae1bdea02b0f56de766a08ed68f3e3a9ec Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Wed, 25 Oct 2023 14:24:59 +1100 Subject: [PATCH 7/7] feat: use multi value to know if disappear_v2 is live or nah --- .../open_group_api/sogsv3/sogsV3ClearInbox.ts | 60 +++++++++---------- ts/util/releaseFeature.ts | 5 +- 2 files changed, 31 insertions(+), 34 deletions(-) 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/util/releaseFeature.ts b/ts/util/releaseFeature.ts index e415c3e14..4acf60c4d 100644 --- a/ts/util/releaseFeature.ts +++ b/ts/util/releaseFeature.ts @@ -1,4 +1,3 @@ -import { isEmpty } from 'lodash'; import { GetNetworkTime } from '../session/apis/snode_api/getNetworkTime'; import { FEATURE_RELEASE_TIMESTAMPS } from '../session/constants'; import { ConfigurationSync } from '../session/utils/job_runners/jobs/ConfigurationSyncJob'; @@ -103,7 +102,7 @@ async function checkIsUserConfigFeatureReleased() { async function checkIsDisappearMessageV2FeatureReleased() { return ( (await checkIsFeatureReleased('disappearing_messages')) || - !isEmpty(process.env.SESSION_FORCE_DISAPPEAR_V2_ENABLED) // FIXME to remove after QA + !!process.env.MULTI?.toLocaleLowerCase().includes('disappear_v2') // FIXME to remove after QA ); } @@ -115,7 +114,7 @@ function isUserConfigFeatureReleasedCached(): boolean { function isDisappearMessageV2FeatureReleasedCached(): boolean { return ( !!isDisappearingMessageFeatureReleased || - !isEmpty(process.env.SESSION_FORCE_DISAPPEAR_V2_ENABLED) // FIXME to remove after QA + !!process.env.MULTI?.toLocaleLowerCase().includes('disappear_v2') // FIXME to remove after QA ); }