getTitle: Return nothing instead of an invalid phone number
This commit is contained in:
parent
22fb69bbb7
commit
62e648da27
3 changed files with 93 additions and 54 deletions
|
@ -108,7 +108,7 @@ export function getSystemName(
|
|||
|
||||
export function getNumber(
|
||||
attributes: Pick<ConversationAttributesType, 'e164' | 'type'>
|
||||
): string {
|
||||
): string | undefined {
|
||||
if (!isDirectConversation(attributes)) {
|
||||
return '';
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ export function getNumber(
|
|||
return renderNumber(e164);
|
||||
}
|
||||
|
||||
export function renderNumber(e164: string): string {
|
||||
export function renderNumber(e164: string): string | undefined {
|
||||
try {
|
||||
const parsedNumber = window.libphonenumberInstance.parse(e164);
|
||||
const regionCode = getRegionCodeForNumber(e164);
|
||||
|
@ -136,6 +136,6 @@ export function renderNumber(e164: string): string {
|
|||
window.libphonenumberFormat.INTERNATIONAL
|
||||
);
|
||||
} catch (e) {
|
||||
return e164;
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue