From c2f876178a0d0ac366dc55f4625dfacce7d7e92d Mon Sep 17 00:00:00 2001 From: hrb-hub <181954414+hrb-hub@users.noreply.github.com> Date: Tue, 26 Nov 2024 15:28:13 +0100 Subject: [PATCH] Fix inline image being removed in mail viewer on forward Issue caused by inline images not being replaced after a loadAll call (without notify) which sanitizes mail body. This is due to the replaceInlineImages call being inside a loadCompleteNotification listener. Fixed by calling loadAll *with* notify in reply. loadAll is also now only called when necessary. Related to #6523 Fix #8003 Co-authored-by: paw --- src/mail-app/mail/view/MailViewerViewModel.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mail-app/mail/view/MailViewerViewModel.ts b/src/mail-app/mail/view/MailViewerViewModel.ts index 7e631fcf9ee..d435e812f44 100644 --- a/src/mail-app/mail/view/MailViewerViewModel.ts +++ b/src/mail-app/mail/view/MailViewerViewModel.ts @@ -791,8 +791,12 @@ export class MailViewerViewModel { if (mailboxDetails == null) { return } - // Call this again to make sure everything is loaded, including inline images because this can be called earlier than all the parts are loaded. - await this.loadAll(Promise.resolve(), { notify: false }) + + const isReloadNeeded = !this.sanitizeResult || this.mail.attachments.length !== this.attachments.length + if (isReloadNeeded) { + // Call this again to make sure everything is loaded, including inline images because this can be called earlier than all the parts are loaded. + await this.loadAll(Promise.resolve(), { notify: true }) + } const editor = await newMailEditorAsResponse(args, this.isBlockingExternalImages(), this.getLoadedInlineImages(), mailboxDetails) editor.show() }