fix: single mode is off by default

pull/2971/head
William Grant 2 years ago
parent 38a8012e10
commit 251f2e1d37

@ -52,7 +52,15 @@ const StyledNonAdminDescription = styled.div`
`;
// TODO legacy messages support will be removed in a future release
function loadDefaultTimeValue(modeSelected: DisappearingMessageConversationModeType | undefined) {
function loadDefaultTimeValue(
modeSelected: DisappearingMessageConversationModeType | undefined,
hasOnlyOneMode: boolean
) {
// NOTE if there is only 1 disappearing message mode available the default state is that it is turned off
if (hasOnlyOneMode) {
return 0;
}
return modeSelected !== 'off'
? modeSelected !== 'legacy'
? modeSelected === 'deleteAfterSend'
@ -134,9 +142,9 @@ export const OverlayDisappearingMessages = () => {
handleSetTime(
expireTimer !== undefined && expireTimer > -1
? expireTimer
: loadDefaultTimeValue(modeSelected)
: loadDefaultTimeValue(modeSelected, hasOnlyOneMode)
);
}, [expireTimer, modeSelected]);
}, [expireTimer, hasOnlyOneMode, modeSelected]);
// useEffect(() => {
// window.log.debug(

Loading…
Cancel
Save