fix: apply archive context-menu action to all selected emails # 212

This commit is contained in:
Linus Rath
2026-04-20 14:35:56 +02:00
parent aa7f886795
commit 24c53e5ce7
2 changed files with 14 additions and 2 deletions
+6 -2
View File
@@ -66,6 +66,7 @@ interface EmailContextMenuProps {
// Batch actions // Batch actions
onBatchMarkAsRead?: (read: boolean) => void; onBatchMarkAsRead?: (read: boolean) => void;
onBatchDelete?: () => void; onBatchDelete?: () => void;
onBatchArchive?: () => void;
onBatchMoveToMailbox?: (mailboxId: string) => void; onBatchMoveToMailbox?: (mailboxId: string) => void;
onBatchMarkAsSpam?: () => void; onBatchMarkAsSpam?: () => void;
onBatchUndoSpam?: () => void; onBatchUndoSpam?: () => void;
@@ -127,6 +128,7 @@ export function EmailContextMenu({
onUndoSpam, onUndoSpam,
onBatchMarkAsRead, onBatchMarkAsRead,
onBatchDelete, onBatchDelete,
onBatchArchive,
onBatchMoveToMailbox, onBatchMoveToMailbox,
onBatchMarkAsSpam, onBatchMarkAsSpam,
onBatchUndoSpam, onBatchUndoSpam,
@@ -235,8 +237,10 @@ export function EmailContextMenu({
<ContextMenuItem <ContextMenuItem
icon={Archive} icon={Archive}
label={t("archive")} label={t("archive")}
onClick={() => handleAction(onArchive!)} onClick={() =>
disabled={!onArchive} handleAction(showBatchActions ? onBatchArchive! : onArchive!)
}
disabled={showBatchActions ? !onBatchArchive : !onArchive}
/> />
{/* Delete */} {/* Delete */}
+8
View File
@@ -496,6 +496,14 @@ export function EmailList({
onEditDraft={() => onEditDraft?.(contextMenu.data!)} onEditDraft={() => onEditDraft?.(contextMenu.data!)}
onBatchMarkAsRead={(read) => client && batchMarkAsRead(client, read)} onBatchMarkAsRead={(read) => client && batchMarkAsRead(client, read)}
onBatchDelete={() => client && batchDelete(client)} onBatchDelete={() => client && batchDelete(client)}
onBatchArchive={async () => {
if (!onArchive) return;
const selected = emails.filter((e) => selectedEmailIds.has(e.id));
for (const email of selected) {
await onArchive(email);
}
clearSelection();
}}
onBatchMoveToMailbox={(mailboxId) => client && batchMoveToMailbox(client, mailboxId)} onBatchMoveToMailbox={(mailboxId) => client && batchMoveToMailbox(client, mailboxId)}
onBatchMarkAsSpam={async () => { onBatchMarkAsSpam={async () => {
if (client) { if (client) {