fix: apply archive context-menu action to all selected emails # 212
This commit is contained in:
@@ -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 */}
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user