Fixes My Story subtitle label in privacy modal

This commit is contained in:
Josh Perez 2022-11-09 21:25:45 -05:00 committed by GitHub
parent 9de31d1b1c
commit 42a1394039
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 17 deletions

View file

@ -5553,7 +5553,7 @@
},
"icu:StoriesSettings__my-story-subtitle": {
"messageformat": "All Signal connections",
"description": "Story settings modal my story distribution list selection subtitle"
"description": "(deleted 2022/11/09) Story settings modal my story distribution list selection subtitle"
},
"icu:StoriesSettings__custom-story-subtitle": {
"messageformat": "Custom story",
@ -5668,7 +5668,7 @@
"description": "Learn more link to learn about who can view your story"
},
"StoriesSettings__context-menu": {
"message": "Story settings",
"message": "Story privacy",
"description": "Button label to get to story settings"
},
"StoriesSettings__view-receipts--label": {

View file

@ -12,6 +12,7 @@ import type { LocalizerType } from '../types/Util';
import type { PreferredBadgeSelectorType } from '../state/selectors/badges';
import type { PropsType as StoriesSettingsModalPropsType } from './StoriesSettingsModal';
import {
getI18nForMyStory,
getListViewers,
DistributionListSettingsModal,
EditDistributionListModal,
@ -107,18 +108,6 @@ function getListMemberUuids(
return memberUuids;
}
function getKeyForMyStoryType(list: StoryDistributionListWithMembersDataType) {
if (list.members.length === 0) {
return 'StoriesSettings__mine__all--label';
}
if (!list.isBlockList) {
return 'SendStoryModal__only-share-with';
}
return 'StoriesSettings__mine__all--label';
}
export const SendStoryModal = ({
draftAttachment,
candidateConversations,
@ -721,7 +710,7 @@ export const SendStoryModal = ({
<>
<span className="SendStoryModal__rtl-span">
{list.id === MY_STORIES_ID
? i18n(getKeyForMyStoryType(list))
? getI18nForMyStory(list, i18n)
: i18n('SendStoryModal__custom-story')}
</span>
<span className="SendStoryModal__rtl-span">

View file

@ -113,6 +113,21 @@ export function getListViewers(
return i18n('icu:StoriesSettings__viewers', { count: memberCount });
}
export function getI18nForMyStory(
list: StoryDistributionListWithMembersDataType,
i18n: LocalizerType
): string {
if (list.members.length === 0) {
return i18n('StoriesSettings__mine__all--label');
}
if (!list.isBlockList) {
return i18n('SendStoryModal__only-share-with');
}
return i18n('StoriesSettings__mine__all--label');
}
type DistributionListItemProps = {
i18n: LocalizerType;
distributionList: StoryDistributionListWithMembersDataType;
@ -138,7 +153,7 @@ function DistributionListItem({
type="button"
>
<span className="StoriesSettingsModal__list__left">
{distributionList.id === MY_STORIES_ID ? (
{isMyStories ? (
<Avatar
acceptedMessageRequest={me.acceptedMessageRequest}
avatarPath={me.avatarPath}
@ -162,7 +177,7 @@ function DistributionListItem({
/>
<span className="StoriesSettingsModal__list__viewers">
{isMyStories
? i18n('icu:StoriesSettings__my-story-subtitle')
? getI18nForMyStory(distributionList, i18n)
: i18n('icu:StoriesSettings__custom-story-subtitle')}
&nbsp;&middot;&nbsp;
{getListViewers(distributionList, i18n, signalConnections)}