fix: Allow ending the conversation if snoozed or pending (#5793)

This commit is contained in:
Pranav Raj S 2022-11-03 13:47:24 -07:00 committed by GitHub
parent 8bd5ba187a
commit 4bb5e812ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View file

@ -10,6 +10,13 @@ export const MESSAGE_TYPE = {
ACTIVITY: 2,
TEMPLATE: 3,
};
export const CONVERSATION_STATUS = {
OPEN: 'open',
RESOLVED: 'resolved',
PENDING: 'pending',
SNOOZED: 'snoozed',
};
// Size in mega bytes
export const MAXIMUM_FILE_UPLOAD_SIZE = 40;
export const MAXIMUM_FILE_UPLOAD_SIZE_TWILIO_SMS_CHANNEL = 5;

View file

@ -1,7 +1,7 @@
<template>
<div v-if="showHeaderActions" class="actions flex items-center">
<button
v-if="conversationStatus === 'open' && hasEndConversationEnabled"
v-if="canLeaveConversation && hasEndConversationEnabled"
class="button transparent compact"
:title="$t('END_CONVERSATION')"
@click="resolveConversation"
@ -45,6 +45,7 @@ import { popoutChatWindow } from '../helpers/popoutHelper';
import FluentIcon from 'shared/components/FluentIcon/Index.vue';
import darkModeMixin from 'widget/mixins/darkModeMixin';
import configMixin from 'widget/mixins/configMixin';
import { CONVERSATION_STATUS } from 'shared/constants/messages';
export default {
name: 'HeaderActions',
@ -60,6 +61,13 @@ export default {
...mapGetters({
conversationAttributes: 'conversationAttributes/getConversationParams',
}),
canLeaveConversation() {
return [
CONVERSATION_STATUS.OPEN,
CONVERSATION_STATUS.SNOOZED,
CONVERSATION_STATUS.PENDING,
].includes(this.conversationStatus);
},
isIframe() {
return IFrameHelper.isIFrame();
},