From 82bb74a9df8a80bfa533492e081ed2de1bf5dd48 Mon Sep 17 00:00:00 2001 From: William Grant Date: Tue, 5 Sep 2023 15:46:16 +1000 Subject: [PATCH] fix: header subtitle correctly supports legacy again --- .../conversation/header/ConversationHeaderTitle.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ts/components/conversation/header/ConversationHeaderTitle.tsx b/ts/components/conversation/header/ConversationHeaderTitle.tsx index 2b136ba04..37770f38d 100644 --- a/ts/components/conversation/header/ConversationHeaderTitle.tsx +++ b/ts/components/conversation/header/ConversationHeaderTitle.tsx @@ -46,8 +46,9 @@ export const ConversationHeaderTitle = () => { const isGroup = useSelectedIsGroup(); const members = useSelectedMembers(); - const expireTimer = useSelectedExpireTimer(); const expirationType = useSelectedConversationExpirationType(); + const expireTimer = useSelectedExpireTimer(); + const convoName = useConversationUsername(selectedConvoKey); const [visibleSubtitle, setVisibleSubtitle] = useState('notifications'); @@ -80,24 +81,29 @@ export const ConversationHeaderTitle = () => { return null; }, [i18n, isGroup, isKickedFromGroup, isPublic, members.length, subscriberCount]); + // TODO legacy messages support will be removed in a future release const disappearingMessageSubtitle = useMemo(() => { const disappearingMessageSettingText = expirationType === 'deleteAfterRead' ? window.i18n('disappearingMessagesModeAfterRead') : expirationType === 'deleteAfterSend' ? window.i18n('disappearingMessagesModeAfterSend') + : expirationType === 'legacy' + ? isMe || (isGroup && !isPublic) + ? window.i18n('disappearingMessagesModeAfterSend') + : window.i18n('disappearingMessagesModeAfterRead') : null; const abbreviatedExpireTime = isNumber(expireTimer) ? ExpirationTimerOptions.getAbbreviated(expireTimer) : null; - return disappearingMessageSettingText + return expireTimer && disappearingMessageSettingText ? `${disappearingMessageSettingText}${ abbreviatedExpireTime ? ` - ${abbreviatedExpireTime}` : '' }` : null; - }, [expirationType, expireTimer]); + }, [expirationType, expireTimer, isGroup, isMe, isPublic]); const handleRightPanelToggle = () => { if (isRightPanelOn) {