diff --git a/Gemfile.lock b/Gemfile.lock index 6b806fc3d..374555cc3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -555,7 +555,7 @@ GEM rack (2.2.9) rack-attack (6.7.0) rack (>= 1.0, < 4) - rack-contrib (2.4.0) + rack-contrib (2.5.0) rack (< 4) rack-cors (2.0.0) rack (>= 2.0.0) diff --git a/app/javascript/dashboard/api/inbox/conversation.js b/app/javascript/dashboard/api/inbox/conversation.js index 94cc81354..ebc6176e7 100644 --- a/app/javascript/dashboard/api/inbox/conversation.js +++ b/app/javascript/dashboard/api/inbox/conversation.js @@ -15,6 +15,7 @@ class ConversationApi extends ApiClient { teamId, conversationType, sortBy, + updatedWithin, }) { return axios.get(this.url, { params: { @@ -26,6 +27,7 @@ class ConversationApi extends ApiClient { labels, conversation_type: conversationType, sort_by: sortBy, + updated_within: updatedWithin, }, }); } diff --git a/app/javascript/dashboard/api/specs/inbox/conversation.spec.js b/app/javascript/dashboard/api/specs/inbox/conversation.spec.js index ecc833e16..3287d7477 100644 --- a/app/javascript/dashboard/api/specs/inbox/conversation.spec.js +++ b/app/javascript/dashboard/api/specs/inbox/conversation.spec.js @@ -46,6 +46,7 @@ describe('#ConversationAPI', () => { page: 1, labels: [], teamId: 1, + updatedWithin: 20, }); expect(axiosMock.get).toHaveBeenCalledWith('/api/v1/conversations', { params: { @@ -55,6 +56,7 @@ describe('#ConversationAPI', () => { assignee_type: 'me', page: 1, labels: [], + updated_within: 20, }, }); }); diff --git a/app/javascript/dashboard/components/ChatList.vue b/app/javascript/dashboard/components/ChatList.vue index 5b592a1f7..eb410f7d5 100644 --- a/app/javascript/dashboard/components/ChatList.vue +++ b/app/javascript/dashboard/components/ChatList.vue @@ -268,6 +268,7 @@ export default { chatLists: 'getAllConversations', mineChatsList: 'getMineChats', allChatList: 'getAllStatusChats', + chatListFilters: 'getChatListFilters', unAssignedChatsList: 'getUnAssignedChats', chatListLoading: 'getChatListLoadingStatus', currentUserID: 'getCurrentUserID', @@ -293,13 +294,6 @@ export default { hasAppliedFiltersOrActiveFolders() { return this.hasAppliedFilters || this.hasActiveFolders; }, - savedFoldersValue() { - if (this.hasActiveFolders) { - const payload = this.activeFolder.query; - this.fetchSavedFilteredConversations(payload); - } - return {}; - }, showEndOfListMessage() { return ( this.conversationList.length && @@ -375,7 +369,6 @@ export default { labels: this.label ? [this.label] : undefined, teamId: this.teamId || undefined, conversationType: this.conversationType || undefined, - folders: this.hasActiveFolders ? this.savedFoldersValue : undefined, }; }, conversationListPagination() { @@ -488,7 +481,13 @@ export default { this.resetAndFetchData(); this.updateVirtualListProps('conversationType', this.conversationType); }, - activeFolder() { + activeFolder(newVal, oldVal) { + if (newVal !== oldVal) { + this.$store.dispatch( + 'customViews/setActiveConversationFolder', + newVal || null + ); + } this.resetAndFetchData(); this.updateVirtualListProps('foldersId', this.foldersId); }, @@ -498,8 +497,14 @@ export default { showAssigneeInConversationCard(newVal) { this.updateVirtualListProps('showAssignee', newVal); }, + conversationFilters(newVal, oldVal) { + if (newVal !== oldVal) { + this.$store.dispatch('updateChatListFilters', newVal); + } + }, }, mounted() { + this.$store.dispatch('setChatListFilters', this.conversationFilters); this.setFiltersFromUISettings(); this.$store.dispatch('setChatStatusFilter', this.activeStatus); this.$store.dispatch('setChatSortFilter', this.activeSortBy); @@ -509,14 +514,14 @@ export default { this.$store.dispatch('campaigns/get'); } - bus.$on('fetch_conversation_stats', () => { + this.$emitter.on('fetch_conversation_stats', () => { this.$store.dispatch('conversationStats/get', this.conversationFilters); }); - bus.$on(CMD_SNOOZE_CONVERSATION, this.onCmdSnoozeConversation); + this.$emitter.on(CMD_SNOOZE_CONVERSATION, this.onCmdSnoozeConversation); }, beforeDestroy() { - bus.$off(CMD_SNOOZE_CONVERSATION, this.onCmdSnoozeConversation); + this.$emitter.off(CMD_SNOOZE_CONVERSATION, this.onCmdSnoozeConversation); }, methods: { updateVirtualListProps(key, value) { @@ -695,8 +700,9 @@ export default { this.fetchConversations(); }, fetchConversations() { + this.$store.dispatch('updateChatListFilters', this.conversationFilters); this.$store - .dispatch('fetchAllConversations', this.conversationFilters) + .dispatch('fetchAllConversations') .then(this.emitConversationLoaded); }, loadMoreConversations() { @@ -736,7 +742,7 @@ export default { updateAssigneeTab(selectedTab) { if (this.activeAssigneeTab !== selectedTab) { this.resetBulkActions(); - bus.$emit('clearSearchInput'); + this.$emitter.emit('clearSearchInput'); this.activeAssigneeTab = selectedTab; if (!this.currentPage) { this.fetchConversations(); diff --git a/app/javascript/dashboard/components/Code.vue b/app/javascript/dashboard/components/Code.vue index 269311c2d..d8f609e29 100644 --- a/app/javascript/dashboard/components/Code.vue +++ b/app/javascript/dashboard/components/Code.vue @@ -25,8 +25,10 @@