getTitle: Return nothing instead of an invalid phone number
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user