diff --git a/js/mzta-utils.js b/js/mzta-utils.js index d032c4da..90feb52b 100644 --- a/js/mzta-utils.js +++ b/js/mzta-utils.js @@ -94,6 +94,17 @@ export async function getCurrentIdentity(msgHeader, getFull = false) { } } + // Check the account that the folder of the message belongs to + if (msgHeader.folder && msgHeader.folder.accountId) { + const account = accounts.find(a => a.id === msgHeader.folder.accountId); + if (account && account.identities && account.identities.length > 0) { + // Just return the first identity of the account. + const identity = account.identities[0]; + console.log(">>>>>>>>>> got from folder"); + return getFull ? { id: identity.id, email: identity.email } : identity.id; + } + } + // Fallback return getFull ? fallbackIdentity : fallbackIdentity?.id || null; }