Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions src/components/MailboxThread.vue
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export default {
return this.mainStore.getEnvelopes(this.mailbox.databaseId, this.appendToSearch(priorityImportantQuery)).length > 0
|| this.mainStore.getEnvelopes(this.mailbox.databaseId, this.appendToSearch(priorityOtherQuery)).length > 0
}
return this.mainStore.getEnvelopes(this.mailbox.databaseId, this.searchQuery).length > 0
return this.mainStore.getEnvelopes(this.mailbox.databaseId, this.query).length > 0
},

hasImportantEnvelopes() {
Expand Down Expand Up @@ -316,10 +316,7 @@ export default {

query() {
if (this.$route.params.filter === 'starred') {
if (this.searchQuery) {
return this.appendToSearch('is:starred')
}
return 'is:starred'
return this.appendToSearch('is:starred')
}
return this.searchQuery
},
Expand All @@ -329,7 +326,7 @@ export default {
},

groupEnvelopes() {
const allEnvelopes = this.mainStore.getEnvelopes(this.mailbox.databaseId, this.searchQuery)
const allEnvelopes = this.mainStore.getEnvelopes(this.mailbox.databaseId, this.query)
return this.getGroupedEnvelopes(allEnvelopes, this.mainStore.syncTimestamp, this.sortOrder)
},

Expand Down Expand Up @@ -384,11 +381,11 @@ export default {
},

async fetchEnvelopes() {
const existingEnvelopes = this.mainStore.getEnvelopes(this.mailbox.databaseId, this.searchQuery || '')
const existingEnvelopes = this.mainStore.getEnvelopes(this.mailbox.databaseId, this.query)
if (!existingEnvelopes.length) {
await this.mainStore.fetchEnvelopes({
mailboxId: this.mailbox.databaseId,
query: this.searchQuery || '',
query: this.query,
})
}
},
Expand Down
10 changes: 9 additions & 1 deletion src/store/mainStore/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,15 @@ export default function mainStoreActions() {
return Promise.reject(new Error('Cannot find last envelope. Required for the mailbox cursor'))
}

return fetchEnvelopes(mailbox.accountId, mailboxId, query, lastEnvelope.dateInt, quantity, this.getPreference('sort-order')).then((envelopes) => {
return fetchEnvelopes(
mailbox.accountId,
mailboxId,
query,
lastEnvelope.dateInt,
quantity,
this.getPreference('sort-order'),
this.getPreference('layout-message-view'),
).then((envelopes) => {
logger.debug(`fetched ${envelopes.length} messages for mailbox ${mailboxId}`, {
envelopes,
addToUnifiedMailboxes,
Expand Down
8 changes: 5 additions & 3 deletions src/tests/unit/store/actions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ describe('Vuex store actions', () => {
}

store.preferences['sort-order'] = 'newest'
store.preferences['layout-message-view'] = 'threaded'

store.addAccountMutation(account13)
store.addMailboxMutation({
Expand Down Expand Up @@ -245,7 +246,7 @@ describe('Vuex store actions', () => {

expect(MessageService.fetchEnvelopes).toHaveBeenCalledTimes(1)
expect(MessageService.fetchEnvelopes)
.toHaveBeenNthCalledWith(1, 13, 11, undefined, 300000, PAGE_SIZE, 'newest')
.toHaveBeenNthCalledWith(1, 13, 11, undefined, 300000, PAGE_SIZE, 'newest', 'threaded')
expect(store.mailboxes[UNIFIED_INBOX_ID].envelopeLists[''].toSorted()).toEqual([
// Initial envelopes
...msgs1.map(mockEnvelope(11)),
Expand Down Expand Up @@ -335,6 +336,7 @@ describe('Vuex store actions', () => {
}

store.preferences['sort-order'] = 'newest'
store.preferences['layout-message-view'] = 'threaded'

store.addAccountMutation(account13)
store.addAccountMutation(account26)
Expand Down Expand Up @@ -403,9 +405,9 @@ describe('Vuex store actions', () => {

expect(MessageService.fetchEnvelopes).toHaveBeenCalledTimes(2)
expect(MessageService.fetchEnvelopes)
.toHaveBeenNthCalledWith(1, 13, 11, undefined, 300000, PAGE_SIZE, 'newest')
.toHaveBeenNthCalledWith(1, 13, 11, undefined, 300000, PAGE_SIZE, 'newest', 'threaded')
expect(MessageService.fetchEnvelopes)
.toHaveBeenNthCalledWith(2, 26, 21, undefined, 600000, PAGE_SIZE, 'newest')
.toHaveBeenNthCalledWith(2, 26, 21, undefined, 600000, PAGE_SIZE, 'newest', 'threaded')
expect(store.mailboxes[UNIFIED_INBOX_ID].envelopeLists[''].toSorted()).toEqual([
// Initial envelopes
...page1.map(mockEnvelope(11)),
Expand Down
Loading