Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

always show correct simulator name #1897

Merged
merged 1 commit into from
Feb 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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