-
Notifications
You must be signed in to change notification settings - Fork 3
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
[Fix] Send Close Chat Message to Client #172
Conversation
enum/Dialogflow.ts
Outdated
export enum CloseChatDescription { | ||
CLOSED_BY_VISITOR = 'Closed by visitor', | ||
CUSTOMER_IDLE_TIMEOUT = 'Customer Timeout', | ||
INVALID_TARGET_DEPARTMENT = 'Escalation failed due to invalid target department', | ||
SAME_TARGET_DEPARTMENT = 'Escalation failed due to same target department', | ||
LIVEAGENT_BOT_OFFLINE_OR_DISABLED = 'Escalation failed due to liveagent bot offline or disabled', | ||
NETWORK_OR_APP_ERROR = 'Escalation failed due to network or app error', | ||
AGENT_UNASSIGNED = 'Agent is unassigned', | ||
INVALID_EVENT_DATA = 'Invalid Dialogflow event data', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will these messages end up in the widget appearing to visitors?
Can we keep the message more specific? i.e. Chat close after the escalation failed due to invalid target department
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
endpoints/IncomingEndpoint.ts
Outdated
@@ -52,7 +52,7 @@ export class IncomingEndpoint extends ApiEndpoint { | |||
const room = (await read.getRoomReader().getById(sessionId)) as ILivechatRoom; | |||
switch (action) { | |||
case EndpointActionNames.CLOSE_CHAT: | |||
await closeChat(modify, read, sessionId); | |||
await closeChat(modify, read, sessionId, this.app, CloseChatDescription.CLOSED_BY_VISITOR); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is confusing. Chat closed by the /incoming
endpoint is not necessarily closed by the visitor.
lib/payloadAction.ts
Outdated
@@ -77,7 +78,7 @@ export const handlePayloadActions = async ( | |||
} else if (actionName === ActionIds.CLOSE_CHAT) { | |||
const livechatRoom = (await read.getRoomReader().getById(rid)) as ILivechatRoom; | |||
if (livechatRoom && livechatRoom.isOpen) { | |||
await closeChat(modify, read, rid); | |||
await closeChat(modify, read, rid, app, CloseChatDescription.CLOSED_BY_VISITOR); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also confusing, it's closed when we receive close chat action from DF Agent. So it's not closed by visitor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ear-dev This PR is for Setting proper close chat messages. We will need separate story to send close chat event with proper close_method
as well
@AlexanderKanakis most of my tests showed that this PR works as designed. I did find one that is still not correct yet.
Actually that should be handled by the SF app shouldn't it..... just ignore this please. |
Is that issue still something I should look into? I cannot find your comment. |
Ok, I tested as much of these conditions as I could and it looks good. Thanks @AlexanderKanakis |
yeah, I removed it because I realize that that is an issue in the SF.app and will be included in the SF PR. |
Solves: WideChat/Rocket.Chat#1298 and WideChat/Rocket.Chat#1297