()
| 615 | } |
| 616 | |
| 617 | private async archiveTask(): Promise<void> { |
| 618 | try { |
| 619 | const updatedTask = await this.plugin.taskService.toggleArchive(this.task); |
| 620 | |
| 621 | // Update the task reference |
| 622 | this.task = updatedTask; |
| 623 | |
| 624 | // Notify parent component if callback exists |
| 625 | if (this.options.onTaskUpdated) { |
| 626 | this.options.onTaskUpdated(updatedTask); |
| 627 | } |
| 628 | |
| 629 | // Show success message |
| 630 | const actionKey = updatedTask.archived |
| 631 | ? "modals.taskEdit.archiveAction.archived" |
| 632 | : "modals.taskEdit.archiveAction.unarchived"; |
| 633 | const actionText = this.t(actionKey); |
| 634 | new Notice(this.t("modals.taskEdit.notices.archiveSuccess", { action: actionText })); |
| 635 | |
| 636 | // Close the modal |
| 637 | this.close(); |
| 638 | } catch (error) { |
| 639 | tasknotesLogger.error("Failed to archive task:", { |
| 640 | category: "persistence", |
| 641 | operation: "archive-task", |
| 642 | error: error, |
| 643 | }); |
| 644 | new Notice(this.t("modals.taskEdit.notices.archiveFailure")); |
| 645 | } |
| 646 | } |
| 647 | |
| 648 | private async deleteTask(): Promise<void> { |
| 649 | const confirmed = await showConfirmationModal(this.app, { |
no test coverage detected