Group call started notification use address book name
This commit is contained in:
parent
d7b09b9703
commit
342373bdfe
3 changed files with 22 additions and 25 deletions
|
@ -9,6 +9,7 @@ import enMessages from '../../../_locales/en/messages.json';
|
|||
import { CallMode } from '../../types/Calling';
|
||||
import { CallingNotification } from './CallingNotification';
|
||||
import type { CallingNotificationType } from '../../util/callingNotification';
|
||||
import { getDefaultConversation } from '../../test-both/helpers/getDefaultConversation';
|
||||
|
||||
const i18n = setupI18n('en', enMessages);
|
||||
|
||||
|
@ -235,7 +236,7 @@ export function GroupCallByYou(): JSX.Element {
|
|||
<CallingNotification
|
||||
{...getCommonProps()}
|
||||
callMode={CallMode.Group}
|
||||
creator={{ isMe: true, title: 'Alicia' }}
|
||||
creator={getDefaultConversation({ isMe: true, title: 'Alicia' })}
|
||||
deviceCount={15}
|
||||
ended={false}
|
||||
maxDevices={16}
|
||||
|
@ -249,7 +250,7 @@ export function GroupCallBySomeone(): JSX.Element {
|
|||
<CallingNotification
|
||||
{...getCommonProps()}
|
||||
callMode={CallMode.Group}
|
||||
creator={{ isMe: false, title: 'Alicia' }}
|
||||
creator={getDefaultConversation({ isMe: false, title: 'Alicia' })}
|
||||
deviceCount={15}
|
||||
ended={false}
|
||||
maxDevices={16}
|
||||
|
@ -265,10 +266,9 @@ export function GroupCallStartedBySomeoneWithALongName(): JSX.Element {
|
|||
<CallingNotification
|
||||
{...getCommonProps()}
|
||||
callMode={CallMode.Group}
|
||||
creator={{
|
||||
isMe: false,
|
||||
creator={getDefaultConversation({
|
||||
title: longName,
|
||||
}}
|
||||
})}
|
||||
deviceCount={15}
|
||||
ended={false}
|
||||
maxDevices={16}
|
||||
|
|
|
@ -6,6 +6,7 @@ import { getCallingNotificationText } from '../../util/callingNotification';
|
|||
import { CallMode } from '../../types/Calling';
|
||||
import { setupI18n } from '../../util/setupI18n';
|
||||
import enMessages from '../../../_locales/en/messages.json';
|
||||
import { getDefaultConversation } from '../helpers/getDefaultConversation';
|
||||
|
||||
describe('calling notification helpers', () => {
|
||||
const i18n = setupI18n('en', enMessages);
|
||||
|
@ -31,16 +32,15 @@ describe('calling notification helpers', () => {
|
|||
});
|
||||
|
||||
it("includes the creator's first name when describing a call", () => {
|
||||
const conversation = getDefaultConversation({
|
||||
systemGivenName: 'Luigi',
|
||||
});
|
||||
assert.strictEqual(
|
||||
getCallingNotificationText(
|
||||
{
|
||||
callMode: CallMode.Group,
|
||||
conversationId: 'abc123',
|
||||
creator: {
|
||||
firstName: 'Luigi',
|
||||
isMe: false,
|
||||
title: 'Luigi Mario',
|
||||
},
|
||||
creator: conversation,
|
||||
ended: false,
|
||||
deviceCount: 1,
|
||||
maxDevices: 23,
|
||||
|
@ -53,15 +53,16 @@ describe('calling notification helpers', () => {
|
|||
});
|
||||
|
||||
it("if the creator doesn't have a first name, falls back to their title", () => {
|
||||
const conversation = getDefaultConversation({
|
||||
systemGivenName: undefined,
|
||||
title: 'Luigi Mario',
|
||||
});
|
||||
assert.strictEqual(
|
||||
getCallingNotificationText(
|
||||
{
|
||||
callMode: CallMode.Group,
|
||||
conversationId: 'abc123',
|
||||
creator: {
|
||||
isMe: false,
|
||||
title: 'Luigi Mario',
|
||||
},
|
||||
creator: conversation,
|
||||
ended: false,
|
||||
deviceCount: 1,
|
||||
maxDevices: 23,
|
||||
|
@ -74,16 +75,15 @@ describe('calling notification helpers', () => {
|
|||
});
|
||||
|
||||
it('has a special message if you were the one to start the call', () => {
|
||||
const conversation = getDefaultConversation({
|
||||
isMe: true,
|
||||
});
|
||||
assert.strictEqual(
|
||||
getCallingNotificationText(
|
||||
{
|
||||
callMode: CallMode.Group,
|
||||
conversationId: 'abc123',
|
||||
creator: {
|
||||
firstName: 'ShouldBeIgnored',
|
||||
isMe: true,
|
||||
title: 'ShouldBeIgnored Smith',
|
||||
},
|
||||
creator: conversation,
|
||||
ended: false,
|
||||
deviceCount: 1,
|
||||
maxDevices: 23,
|
||||
|
|
|
@ -5,6 +5,7 @@ import type { LocalizerType } from '../types/Util';
|
|||
import { CallMode } from '../types/Calling';
|
||||
import { missingCaseError } from './missingCaseError';
|
||||
import * as log from '../logging/log';
|
||||
import type { ConversationType } from '../state/ducks/conversations';
|
||||
|
||||
type DirectCallNotificationType = {
|
||||
callMode: CallMode.Direct;
|
||||
|
@ -20,11 +21,7 @@ type GroupCallNotificationType = {
|
|||
activeCallConversationId?: string;
|
||||
callMode: CallMode.Group;
|
||||
conversationId: string;
|
||||
creator?: {
|
||||
firstName?: string;
|
||||
isMe?: boolean;
|
||||
title: string;
|
||||
};
|
||||
creator?: ConversationType;
|
||||
ended: boolean;
|
||||
deviceCount: number;
|
||||
maxDevices: number;
|
||||
|
@ -90,7 +87,7 @@ function getGroupCallNotificationText(
|
|||
return i18n('calling__call-notification__started-by-you');
|
||||
}
|
||||
return i18n('calling__call-notification__started', [
|
||||
notification.creator.firstName || notification.creator.title,
|
||||
notification.creator.systemGivenName ?? notification.creator.title,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue