Skip to content

Commit

Permalink
Merge pull request #1897 from glific/simulator-name-fixes
Browse files Browse the repository at this point in the history
always show correct simulator name
  • Loading branch information
mdshamoon authored Feb 7, 2022
2 parents a6f739e + 1d1b0fb commit e20d47b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit e20d47b

Please sign in to comment.