mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-10-31 00:12:39 +00:00
Batch actions (delete, move, archive, mark-as-read) performed while viewing a shared/group mailbox directly from the "Shared" sidebar section were dispatched to the user's OWN account instead of the shared owner account. Emails in that view are undecorated (no sourceAccountId, that is only set in unified/cross-account views) and are reached through the active client, so they fell into the '__default__' bucket / non-unified else-branch, which defaults the JMAP accountId to the active account. batchArchive independently picked the archive folder from the merged mailbox list, where the user's own archive is listed first. Stalwart then applies Email/set to the wrong account: because the ids belong to the shared account it returns them as `updated: null` with an unchanged state (a silent no-op, not `notUpdated`), so the UI drops the rows optimistically and they reappear on the next reload. It only appears to work when the own and shared folder ids happen to collide. Add resolveViewAccountId() — the owner accountId of the directly-viewed shared folder (from the selected namespaced mailbox), undefined for a normal own-account view, mirroring fetchEmails and the single-email path. Route the four batch actions to that owner account (via the active client); batchMoveToMailbox also resolves the destination to its bare originalId, and batchArchive scopes the archive folder to that account. Own-account and unified/cross-account views are unchanged. Adds email-store-shared-folder-actions.test.ts covering all four batch actions in the non-unified shared view plus an own-account regression.