GroupNotification: Fix 'joined group' pluralization (#4380)
This commit is contained in:
parent
4a83adfad6
commit
fd6358ac9d
2 changed files with 36 additions and 23 deletions
|
@ -179,6 +179,29 @@ const stories: Array<GroupNotificationStory> = [
|
|||
],
|
||||
i18n,
|
||||
},
|
||||
{
|
||||
from: {
|
||||
name: 'Alice',
|
||||
phoneNumber: '(202) 555-1000',
|
||||
},
|
||||
changes: [
|
||||
{
|
||||
type: 'add',
|
||||
contacts: [
|
||||
{
|
||||
phoneNumber: '(202) 555-1000',
|
||||
profileName: 'Mr. Fire',
|
||||
isMe: true,
|
||||
},
|
||||
{
|
||||
phoneNumber: '(202) 555-1001',
|
||||
profileName: 'Mrs. Ice',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
i18n,
|
||||
},
|
||||
],
|
||||
],
|
||||
[
|
||||
|
|
|
@ -75,35 +75,25 @@ export class GroupNotification extends React.Component<Props> {
|
|||
throw new Error('Group update is missing contacts');
|
||||
}
|
||||
|
||||
if (contacts.length === 1) {
|
||||
if (contactsIncludesMe) {
|
||||
return <Intl i18n={i18n} id="youJoinedTheGroup" />;
|
||||
} else {
|
||||
return (
|
||||
<Intl
|
||||
i18n={i18n}
|
||||
id="joinedTheGroup"
|
||||
components={[otherPeopleWithCommas]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const joinedKey =
|
||||
contacts.length > 1 ? 'multipleJoinedTheGroup' : 'joinedTheGroup';
|
||||
const otherPeopleNotifMsg =
|
||||
otherPeople.length === 1
|
||||
? 'joinedTheGroup'
|
||||
: 'multipleJoinedTheGroup';
|
||||
|
||||
return (
|
||||
<>
|
||||
<Intl
|
||||
i18n={i18n}
|
||||
id={joinedKey}
|
||||
components={[otherPeopleWithCommas]}
|
||||
/>
|
||||
{contactsIncludesMe ? (
|
||||
{otherPeople.length > 0 && (
|
||||
<Intl
|
||||
i18n={i18n}
|
||||
id={otherPeopleNotifMsg}
|
||||
components={[otherPeopleWithCommas]}
|
||||
/>
|
||||
)}
|
||||
{contactsIncludesMe && (
|
||||
<div className="module-group-notification__change">
|
||||
<Intl i18n={i18n} id="youJoinedTheGroup" />
|
||||
</div>
|
||||
) : null}
|
||||
)}
|
||||
</>
|
||||
);
|
||||
case 'remove':
|
||||
|
|
Loading…
Reference in a new issue