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..3e251f42b 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); @@ -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() { diff --git a/app/javascript/dashboard/routes/dashboard/inbox/InboxList.vue b/app/javascript/dashboard/routes/dashboard/inbox/InboxList.vue index 93ba310c3..f120bbea5 100644 --- a/app/javascript/dashboard/routes/dashboard/inbox/InboxList.vue +++ b/app/javascript/dashboard/routes/dashboard/inbox/InboxList.vue @@ -47,6 +47,7 @@