Skip to content

Commit

Permalink
Fix unsetting sticky mail ID
Browse files Browse the repository at this point in the history
This was broken. However, we don't actually need to grab the
MailSetEntry, as we can simply extract the mail ID from the ID of the
entry.
  • Loading branch information
paw-hub authored and hrb-hub committed Jan 24, 2025
1 parent 8727eec commit 1cd868d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/mail-app/mail/view/MailViewModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ import {
MailSetEntryTypeRef,
MailTypeRef,
} from "../../../common/api/entities/tutanota/TypeRefs.js"
import { elementIdPart, firstBiggerThanSecond, getElementId, isSameId, listIdPart } from "../../../common/api/common/utils/EntityUtils.js"
import {
deconstructMailSetEntryId,
elementIdPart,
firstBiggerThanSecond,
getElementId,
isSameId,
listIdPart,
} from "../../../common/api/common/utils/EntityUtils.js"
import {
assertNotNull,
count,
Expand Down Expand Up @@ -503,8 +510,8 @@ export class MailViewModel {
for (const update of updates) {
if (isUpdateForTypeRef(MailSetEntryTypeRef, update) && isSameId(folder.entries, update.instanceListId)) {
if (update.operation === OperationType.DELETE && this.stickyMailId != null) {
const entry = listModel.getMailSetEntry(update.instanceId)
if (entry && isSameId(entry.mail, this.stickyMailId)) {
const { mailId } = deconstructMailSetEntryId(update.instanceId)
if (isSameId(mailId, elementIdPart(this.stickyMailId))) {
// Reset target before we dispatch event to the list so that our handler in onListStateChange() has up-to-date state.
this.stickyMailId = null
}
Expand Down

0 comments on commit 1cd868d

Please sign in to comment.