From 6ae606c981ffdbf5f711de28fb7e587fe5d0da20 Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Date: Thu, 4 Jul 2024 13:13:03 +0530 Subject: [PATCH] fix: Custom snooze is not working in mobile view (#9717) # Pull Request Template ## Description Currently, when a user navigates to a chat and attempts to access the custom snooze modal, it is not visible, making it unable to set custom snooze options. With this fix, the custom snooze modal will correctly display even when a chat is open in mobile view. **Cause of this issue** The `` component is added to the `` component. To accommodate small screen views, we are using the expanded view. However, if we open a chat and select the custom snooze option from the chat header in the message view, the `` component is hidden in the `` component. **Solution** So, I moved the `` to the wrapper component `` so we can use in all cases like, 1. Right-click to custom snooze 2. CMD bar custom snooze 3. Small screen custom snooze --- .../dashboard/components/ChatList.vue | 58 ----------------- .../conversation/ConversationView.vue | 62 ++++++++++++++++++- 2 files changed, 60 insertions(+), 60 deletions(-) diff --git a/app/javascript/dashboard/components/ChatList.vue b/app/javascript/dashboard/components/ChatList.vue index eb410f7d5..ee5354027 100644 --- a/app/javascript/dashboard/components/ChatList.vue +++ b/app/javascript/dashboard/components/ChatList.vue @@ -111,15 +111,6 @@ @updateFolder="onUpdateSavedFilter" /> - - - @@ -152,10 +143,6 @@ import { isOnUnattendedView, } from '../store/modules/conversations/helpers/actionHelpers'; import { CONVERSATION_EVENTS } from '../helper/AnalyticsHelper/events'; -import { CMD_SNOOZE_CONVERSATION } from 'dashboard/routes/dashboard/commands/commandBarBusEvents'; -import { findSnoozeTime } from 'dashboard/helper/snoozeHelpers'; -import { getUnixTime } from 'date-fns'; -import CustomSnoozeModal from 'dashboard/components/CustomSnoozeModal.vue'; import IntersectionObserver from './IntersectionObserver.vue'; export default { @@ -170,7 +157,6 @@ export default { ConversationBulkActions, IntersectionObserver, VirtualList, - CustomSnoozeModal, }, mixins: [ timeMixin, @@ -247,7 +233,6 @@ export default { root: this.$refs.conversationList, rootMargin: '100px 0px 100px 0px', }, - showCustomSnoozeModal: false, itemComponent: ConversationItem, // virtualListExtraProps is to pass the props to the conversationItem component. @@ -283,7 +268,6 @@ export default { campaigns: 'campaigns/getAllCampaigns', labels: 'labels/getLabels', selectedConversations: 'bulkActions/getSelectedConversationIds', - contextMenuChatId: 'getContextMenuChatId', }), hasAppliedFilters() { return this.appliedFilters.length !== 0; @@ -517,11 +501,6 @@ export default { this.$emitter.on('fetch_conversation_stats', () => { this.$store.dispatch('conversationStats/get', this.conversationFilters); }); - - this.$emitter.on(CMD_SNOOZE_CONVERSATION, this.onCmdSnoozeConversation); - }, - beforeDestroy() { - this.$emitter.off(CMD_SNOOZE_CONVERSATION, this.onCmdSnoozeConversation); }, methods: { updateVirtualListProps(key, value) { @@ -999,43 +978,6 @@ export default { onContextMenuToggle(state) { this.isContextMenuOpen = state; }, - onCmdSnoozeConversation(snoozeType) { - if (snoozeType === wootConstants.SNOOZE_OPTIONS.UNTIL_CUSTOM_TIME) { - this.showCustomSnoozeModal = true; - } else { - this.toggleStatus( - wootConstants.STATUS_TYPE.SNOOZED, - findSnoozeTime(snoozeType) || null - ); - } - }, - chooseSnoozeTime(customSnoozeTime) { - this.showCustomSnoozeModal = false; - if (customSnoozeTime) { - this.toggleStatus( - wootConstants.STATUS_TYPE.SNOOZED, - getUnixTime(customSnoozeTime) - ); - } - }, - toggleStatus(status, snoozedUntil) { - this.$store - .dispatch('toggleStatus', { - conversationId: this.currentChat?.id || this.contextMenuChatId, - status, - snoozedUntil, - }) - .then(() => { - this.$store.dispatch('setContextMenuChatId', null); - this.showAlert(this.$t('CONVERSATION.CHANGE_STATUS')); - }); - }, - hideCustomSnoozeModal() { - // if we select custom snooze and then the custom snooze modal is open - // Then if the custom snooze modal is closed and set the context menu chat id to null - this.$store.dispatch('setContextMenuChatId', null); - this.showCustomSnoozeModal = false; - }, }, }; diff --git a/app/javascript/dashboard/routes/dashboard/conversation/ConversationView.vue b/app/javascript/dashboard/routes/dashboard/conversation/ConversationView.vue index 2235b38f0..cd3cdfb80 100644 --- a/app/javascript/dashboard/routes/dashboard/conversation/ConversationView.vue +++ b/app/javascript/dashboard/routes/dashboard/conversation/ConversationView.vue @@ -22,25 +22,40 @@ :is-on-expanded-layout="isOnExpandedLayout" @contact-panel-toggle="onToggleContactPanel" /> + + +