Skip to content

Commit 98b067d

Browse files
committed
fixup! feat: split envelopes by time of arrival
Signed-off-by: greta <[email protected]>
1 parent 2d42c2a commit 98b067d

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

src/components/Mailbox.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ export default {
192192
await this.prefetchOtherMailboxes()
193193
194194
this.mainStore.setHasFetchedInitialEnvelopesMutation(true)
195+
this.mainStore.updateSyncTimestamp()
195196
},
196197
destroyed() {
197198
this.bus.off('load-more', this.onScroll)

src/components/MailboxThread.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ export default {
239239
hasImportantEnvelopes() {
240240
const map = this.mainStore.getEnvelopes(
241241
this.unifiedInbox.databaseId,
242-
this.appendToSearch(this.priorityImportantQuery)
242+
this.appendToSearch(this.priorityImportantQuery),
243243
)
244244
const envelopes = Array.isArray(map) ? map : Array.from(map?.values() || [])
245245
return envelopes.length > 0
@@ -296,7 +296,7 @@ export default {
296296
},
297297
groupEnvelopes() {
298298
const allEnvelopes = this.mainStore.getEnvelopes(this.mailbox.databaseId, this.searchQuery)
299-
return this.groupEnvelopesByDate(allEnvelopes)
299+
return this.groupEnvelopesByDate(allEnvelopes, this.mainStore.syncTimestamp)
300300
},
301301
},
302302
watch: {
@@ -334,8 +334,8 @@ export default {
334334
clearTimeout(this.startMailboxTimer)
335335
},
336336
methods: {
337-
groupEnvelopesByDate(envelopes) {
338-
const now = new Date()
337+
groupEnvelopesByDate(envelopes, syncTimestamp) {
338+
const now = new Date(syncTimestamp)
339339
const oneHourAgo = new Date(now.getTime() - 60 * 60 * 1000)
340340
const startOfToday = new Date(now.getFullYear(), now.getMonth(), now.getDate())
341341
const startOfYesterday = new Date(startOfToday)

src/store/mainStore.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
export default defineStore('main', {
1717
state: () => {
1818
return {
19+
syncTimestamp: Date.now(),
1920
isExpiredSession: false,
2021
preferences: {},
2122
accountsUnmapped: {

src/store/mainStore/actions.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@ function transformMailboxName(account, mailbox) {
188188

189189
export default function mainStoreActions() {
190190
return {
191+
updateSyncTimestamp() {
192+
this.syncTimestamp = Date.now()
193+
},
191194
savePreference({
192195
key,
193196
value,

0 commit comments

Comments
 (0)