Skip to content

Commit f530ac4

Browse files
committed
fix: never abbreviate DaR/S duration except in selector
1 parent 613222f commit f530ac4

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

ts/components/conversation/header/ConversationHeaderTitle.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ function useSubtitleArray(convoId?: string) {
4747
const notification = useSelectedNotificationSetting();
4848
const disappearingMessageSubtitle = useDisappearingMessageSettingText({
4949
convoId,
50-
abbreviate: true,
5150
});
5251

5352
const notificationSubtitle = useLocalisedNotificationOf(notification, 'title');

ts/hooks/useParamSelector.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -495,13 +495,12 @@ export function useSortedGroupMembers(convoId: string | undefined): Array<Pubkey
495495
return compact(members.slice()?.sort());
496496
}
497497

498-
export function useDisappearingMessageSettingText({
499-
convoId,
500-
abbreviate,
501-
}: {
502-
convoId?: string;
503-
abbreviate?: boolean;
504-
}) {
498+
/**
499+
* Returns the disappearing message setting text for the convoId.
500+
* Note: the time is not localised and displayed always in its shortened version (i.e. 2weeks -> 2w).
501+
* This is because 2w is assumed to understood by every locales as 2 weeks, but 2 weeks might not be.
502+
*/
503+
export function useDisappearingMessageSettingText({ convoId }: { convoId?: string }) {
505504
const convoProps = useConversationPropsById(convoId);
506505

507506
const offReturn = { id: 'off', label: localize('off').toString() };
@@ -511,11 +510,7 @@ export function useDisappearingMessageSettingText({
511510

512511
const { expirationMode, expireTimer } = convoProps;
513512

514-
const expireTimerText = isNumber(expireTimer)
515-
? abbreviate
516-
? TimerOptions.getAbbreviated(expireTimer)
517-
: TimerOptions.getName(expireTimer)
518-
: null;
513+
const expireTimerText = isNumber(expireTimer) ? TimerOptions.getAbbreviated(expireTimer) : null;
519514

520515
if (!expireTimerText) {
521516
return offReturn;

0 commit comments

Comments
 (0)