MCPcopy
hub / github.com/callumalpass/tasknotes / deleteTask

Method deleteTask

src/modals/TaskEditModal.ts:648–676  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

646 }
647
648 private async deleteTask(): Promise<void> {
649 const confirmed = await showConfirmationModal(this.app, {
650 title: this.t("modals.taskEdit.deleteConfirmation.title"),
651 message: this.t("modals.taskEdit.deleteConfirmation.message", {
652 title: this.task.title,
653 }),
654 confirmText: this.t("modals.taskEdit.deleteConfirmation.confirm"),
655 cancelText: this.t("common.cancel"),
656 isDestructive: true,
657 });
658
659 if (!confirmed) {
660 return;
661 }
662
663 try {
664 await this.plugin.taskService.deleteTask(this.task);
665 new Notice(this.t("modals.taskEdit.notices.deleteSuccess", { title: this.task.title }));
666 this.forceClose();
667 } catch (error) {
668 const message = error instanceof Error ? error.message : String(error);
669 tasknotesLogger.error("Failed to delete task:", {
670 category: "persistence",
671 operation: "delete-task",
672 error: error,
673 });
674 new Notice(this.t("modals.taskEdit.notices.deleteFailure", { message }));
675 }
676 }
677
678 protected createActionButtons(container: HTMLElement): void {
679 createTaskModalActionButtons(this.getActionButtonContext(), {

Callers 1

createActionButtonsMethod · 0.95

Calls 4

forceCloseMethod · 0.95
showConfirmationModalFunction · 0.90
errorMethod · 0.80
tMethod · 0.45

Tested by

no test coverage detected