From 1d1b0fb5aba37e10c4f59b0f7fcc24d3aba8d16f Mon Sep 17 00:00:00 2001 From: Kurund Jalmi Date: Sun, 6 Feb 2022 15:49:34 +0000 Subject: [PATCH] always show correct simulator name --- src/common/utils.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/common/utils.ts b/src/common/utils.ts index f6b765c6e..1727b7dc3 100644 --- a/src/common/utils.ts +++ b/src/common/utils.ts @@ -2,6 +2,7 @@ import axios from 'axios'; import { FLOW_EDITOR_API } from 'config'; import setLogs from 'config/logs'; import { getAuthSession } from 'services/AuthService'; +import { SIMULATOR_NUMBER_START } from './constants'; import { setNotification } from './notification'; export const getObject = (arr: any, data: any) => { @@ -104,6 +105,12 @@ export const getInteractiveMessageBody = (interactiveJSON: any) => { }; export const getDisplayName = (conversation: any) => { + // let's return early with default simulator name if we are looking at simulator contact + const isSimulatorContact = conversation.contact.phone.startsWith(SIMULATOR_NUMBER_START); + if (isSimulatorContact) { + return conversation.contact.name; + } + let displayName = ''; let contactFields: any = {}; try {