Added manual conversation creation BOD-379
This commit is contained in:
@@ -32,6 +32,7 @@ export function* onOpenChatByPhone() {
|
||||
export function* openChatByPhone({ payload }) {
|
||||
logImEXEvent("messaging_open_by_phone");
|
||||
const { phone_num, jobid } = payload;
|
||||
|
||||
const bodyshop = yield select(selectBodyshop);
|
||||
try {
|
||||
const {
|
||||
@@ -39,7 +40,9 @@ export function* openChatByPhone({ payload }) {
|
||||
} = yield client.query({
|
||||
query: CONVERSATION_ID_BY_PHONE,
|
||||
variables: { phone: phone(phone_num)[0] },
|
||||
fetchPolicy: "network-only",
|
||||
});
|
||||
|
||||
if (conversations.length === 0) {
|
||||
const {
|
||||
data: {
|
||||
@@ -61,13 +64,14 @@ export function* openChatByPhone({ payload }) {
|
||||
} else if (conversations.length === 1) {
|
||||
//got the ID. Open it.
|
||||
yield put(setSelectedConversation(conversations[0].id));
|
||||
yield client.mutate({
|
||||
mutation: INSERT_CONVERSATION_TAG,
|
||||
variables: {
|
||||
conversationId: conversations[0].id,
|
||||
jobId: jobid,
|
||||
},
|
||||
});
|
||||
if (jobid)
|
||||
yield client.mutate({
|
||||
mutation: INSERT_CONVERSATION_TAG,
|
||||
variables: {
|
||||
conversationId: conversations[0].id,
|
||||
jobId: jobid,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
console.log("ERROR: Multiple conversations found. "); //TODO Graceful handling of this situation
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user