Skip to content

Commit 63a8f04

Browse files
committed
fix: conversation list view filters, views do not need list status as views are already filtered.
1 parent ea0b7d6 commit 63a8f04

File tree

2 files changed

+31
-8
lines changed

2 files changed

+31
-8
lines changed

frontend/src/stores/conversation.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ export const useConversationStore = defineStore('conversation', () => {
125125
}
126126
}
127127

128+
const getListStatus = computed(() => {
129+
return conversations.status
130+
})
131+
128132
function setListSortField (field) {
129133
if (conversations.sortField === field) return
130134
conversations.sortField = field
@@ -136,9 +140,6 @@ export const useConversationStore = defineStore('conversation', () => {
136140
return sortFieldLabels[conversations.sortField]
137141
})
138142

139-
const getListStatus = computed(() => {
140-
return conversations.status
141-
})
142143

143144
async function fetchStatuses () {
144145
if (statuses.value.length > 0) return
@@ -174,11 +175,14 @@ export const useConversationStore = defineStore('conversation', () => {
174175

175176
const conversationsList = computed(() => {
176177
if (!conversations.data) return []
177-
// Filter by status.
178178
let filteredConversations = conversations.data
179-
.filter(conv => {
180-
return conv.status === conversations.status
181-
})
179+
// Filter by status if set.
180+
if (conversations.status !== "") {
181+
filteredConversations = conversations.data
182+
.filter(conv => {
183+
return conv.status === conversations.status
184+
})
185+
}
182186

183187
// Sort conversations based on the selected sort field
184188
return [...filteredConversations].sort((a, b) => {

frontend/src/views/inbox/InboxView.vue

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,19 @@ const conversationStore = useConversationStore()
2121
onMounted(() => {
2222
// Fetch list based on type
2323
if (type.value) {
24-
conversationStore.setListStatus(CONVERSATION_DEFAULT_STATUSES.OPEN, false)
24+
// Set list status if not already set
25+
if (!conversationStore.getListStatus) {
26+
conversationStore.setListStatus(CONVERSATION_DEFAULT_STATUSES.OPEN, false)
27+
}
2528
conversationStore.resetCurrentConversation()
2629
conversationStore.fetchConversationsList(true, type.value)
2730
}
2831
// Fetch team list.
2932
if (teamID.value) {
33+
// Set list status if not already set
34+
if (!conversationStore.getListStatus) {
35+
conversationStore.setListStatus(CONVERSATION_DEFAULT_STATUSES.OPEN, false)
36+
}
3037
conversationStore.resetCurrentConversation()
3138
conversationStore.fetchConversationsList(
3239
true,
@@ -36,6 +43,8 @@ onMounted(() => {
3643
}
3744
// Fetch view list.
3845
if (viewID.value) {
46+
// Empty out list status as views are already filtered.
47+
conversationStore.setListStatus('', false)
3948
conversationStore.resetCurrentConversation()
4049
conversationStore.fetchConversationsList(true, CONVERSATION_LIST_TYPE.VIEW, 0, [], viewID.value)
4150
}
@@ -46,16 +55,26 @@ watch(
4655
[type, teamID, viewID],
4756
([newType, newTeamID, newViewID], [oldType, oldTeamID, oldViewID]) => {
4857
if (newType !== oldType && newType) {
58+
// Set list status if not already set
59+
if (!conversationStore.getListStatus) {
60+
conversationStore.setListStatus(CONVERSATION_DEFAULT_STATUSES.OPEN, false)
61+
}
4962
conversationStore.fetchConversationsList(true, newType)
5063
}
5164
if (newTeamID !== oldTeamID && newTeamID) {
65+
// Set list status if not already set
66+
if (!conversationStore.getListStatus) {
67+
conversationStore.setListStatus(CONVERSATION_DEFAULT_STATUSES.OPEN, false)
68+
}
5269
conversationStore.fetchConversationsList(
5370
true,
5471
CONVERSATION_LIST_TYPE.TEAM_UNASSIGNED,
5572
newTeamID
5673
)
5774
}
5875
if (newViewID !== oldViewID && newViewID) {
76+
// Empty out list status as views are already filtered.
77+
conversationStore.setListStatus('', false)
5978
conversationStore.fetchConversationsList(true, CONVERSATION_LIST_TYPE.VIEW, 0, [], newViewID)
6079
}
6180
}

0 commit comments

Comments
 (0)