GroupNotification: Use singular string when we have just one contact
This commit is contained in:
parent
419f219f91
commit
205ee6c6ac
1 changed files with 7 additions and 4 deletions
|
@ -2,7 +2,7 @@ import React from 'react';
|
||||||
import { compact, flatten } from 'lodash';
|
import { compact, flatten } from 'lodash';
|
||||||
|
|
||||||
import { ContactName } from './ContactName';
|
import { ContactName } from './ContactName';
|
||||||
import { FullJSXType, Intl } from '../Intl';
|
import { Intl } from '../Intl';
|
||||||
import { LocalizerType } from '../../types/Util';
|
import { LocalizerType } from '../../types/Util';
|
||||||
|
|
||||||
import { missingCaseError } from '../../util/missingCaseError';
|
import { missingCaseError } from '../../util/missingCaseError';
|
||||||
|
@ -36,7 +36,7 @@ export class GroupNotification extends React.Component<Props> {
|
||||||
const { contacts, type, newName } = change;
|
const { contacts, type, newName } = change;
|
||||||
const { i18n } = this.props;
|
const { i18n } = this.props;
|
||||||
|
|
||||||
const otherPeople = compact(
|
const otherPeople: Array<JSX.Element> = compact(
|
||||||
(contacts || []).map(contact => {
|
(contacts || []).map(contact => {
|
||||||
if (contact.isMe) {
|
if (contact.isMe) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -56,7 +56,7 @@ export class GroupNotification extends React.Component<Props> {
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
const otherPeopleWithCommas: FullJSXType = compact(
|
const otherPeopleWithCommas: Array<JSX.Element | string> = compact(
|
||||||
flatten(
|
flatten(
|
||||||
otherPeople.map((person, index) => [index > 0 ? ', ' : null, person])
|
otherPeople.map((person, index) => [index > 0 ? ', ' : null, person])
|
||||||
)
|
)
|
||||||
|
@ -89,11 +89,14 @@ export class GroupNotification extends React.Component<Props> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const joinedKey =
|
||||||
|
contacts.length > 1 ? 'multipleJoinedTheGroup' : 'joinedTheGroup';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Intl
|
<Intl
|
||||||
i18n={i18n}
|
i18n={i18n}
|
||||||
id="multipleJoinedTheGroup"
|
id={joinedKey}
|
||||||
components={[otherPeopleWithCommas]}
|
components={[otherPeopleWithCommas]}
|
||||||
/>
|
/>
|
||||||
{contactsIncludesMe ? (
|
{contactsIncludesMe ? (
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue