Skip to content

Commit

Permalink
Fix mail highliting for legacyMailFolder user
Browse files Browse the repository at this point in the history
  • Loading branch information
tuta-sudipg committed Aug 14, 2024
1 parent c0cf47e commit bff7585
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions src/mail-app/mail/view/MailViewModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
count,
debounce,
groupByAndMap,
isNotEmpty,
lastThrow,
lazyMemoized,
mapWith,
Expand Down Expand Up @@ -300,18 +299,8 @@ export class MailViewModel {

async entityEventsReceivedForLegacy(updates: ReadonlyArray<EntityUpdateData>) {
for (const update of updates) {
if (isUpdateForTypeRef(MailTypeRef, update)) {
const listModel = this.listModel
if (listModel !== null) {
if (update.operation === OperationType.UPDATE) {
const mail = await this.entityClient.load(MailTypeRef, [update.instanceListId, update.instanceId])
if (isNotEmpty(mail.sets.filter((folder) => folder == this._folder?._id))) {
await listModel.entityEventReceived(update.instanceListId, update.instanceId, update.operation)
}
} else if (this._folder?.mails === update.instanceListId) {
await listModel.entityEventReceived(update.instanceListId, update.instanceId, update.operation)
}
}
if (isUpdateForTypeRef(MailTypeRef, update) && update.instanceListId === this._folder?.mails) {
await this.listModel?.entityEventReceived(update.instanceListId, update.instanceId, update.operation)
}
}
}
Expand Down Expand Up @@ -346,7 +335,7 @@ export class MailViewModel {
await this.listModel?.entityEventReceived(mailEvent.instanceListId, mailEvent.instanceId, OperationType.DELETE)
} else if (mailEvent && !oldEntryEvent && !newEntryEvent) {
const mail = await this.entityClient.load(MailTypeRef, [mailEvent.instanceListId, mailEvent.instanceId])
if (mail.sets.find((id) => isSameId(elementIdPart(id), getElementId(folder)))) {
if (mail.sets.some((id) => isSameId(elementIdPart(id), getElementId(folder)))) {
await this.listModel?.entityEventReceived(mailEvent.instanceListId, mailEvent.instanceId, mailEvent.operation)
}
}
Expand Down

0 comments on commit bff7585

Please sign in to comment.