mirror of
https://github.com/zadam/trilium.git
synced 2025-11-16 13:34:30 +01:00
fix(calendar): unable to delete in journal (closes #7702)
Some checks are pending
Checks / main (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
Deploy Documentation / Build and Deploy Documentation (push) Waiting to run
Dev / Test development (push) Waiting to run
Dev / Build Docker image (push) Blocked by required conditions
Dev / Check Docker build (Dockerfile) (push) Blocked by required conditions
Dev / Check Docker build (Dockerfile.alpine) (push) Blocked by required conditions
/ Check Docker build (Dockerfile) (push) Waiting to run
/ Check Docker build (Dockerfile.alpine) (push) Waiting to run
/ Build Docker images (Dockerfile, ubuntu-24.04-arm, linux/arm64) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.alpine, ubuntu-latest, linux/amd64) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.legacy, ubuntu-24.04-arm, linux/arm/v7) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.legacy, ubuntu-24.04-arm, linux/arm/v8) (push) Blocked by required conditions
/ Merge manifest lists (push) Blocked by required conditions
playwright / E2E tests on linux-arm64 (push) Waiting to run
playwright / E2E tests on linux-x64 (push) Waiting to run
Some checks are pending
Checks / main (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
Deploy Documentation / Build and Deploy Documentation (push) Waiting to run
Dev / Test development (push) Waiting to run
Dev / Build Docker image (push) Blocked by required conditions
Dev / Check Docker build (Dockerfile) (push) Blocked by required conditions
Dev / Check Docker build (Dockerfile.alpine) (push) Blocked by required conditions
/ Check Docker build (Dockerfile) (push) Waiting to run
/ Check Docker build (Dockerfile.alpine) (push) Waiting to run
/ Build Docker images (Dockerfile, ubuntu-24.04-arm, linux/arm64) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.alpine, ubuntu-latest, linux/amd64) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.legacy, ubuntu-24.04-arm, linux/arm/v7) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.legacy, ubuntu-24.04-arm, linux/arm/v8) (push) Blocked by required conditions
/ Merge manifest lists (push) Blocked by required conditions
playwright / E2E tests on linux-arm64 (push) Waiting to run
playwright / E2E tests on linux-x64 (push) Waiting to run
This commit is contained in:
parent
c9f648fcb8
commit
1844a7d666
@ -2,6 +2,7 @@ import FNote from "../../../entities/fnote";
|
|||||||
import contextMenu, { ContextMenuEvent } from "../../../menus/context_menu";
|
import contextMenu, { ContextMenuEvent } from "../../../menus/context_menu";
|
||||||
import link_context_menu from "../../../menus/link_context_menu";
|
import link_context_menu from "../../../menus/link_context_menu";
|
||||||
import branches from "../../../services/branches";
|
import branches from "../../../services/branches";
|
||||||
|
import froca from "../../../services/froca";
|
||||||
import { t } from "../../../services/i18n";
|
import { t } from "../../../services/i18n";
|
||||||
|
|
||||||
export function openCalendarContextMenu(e: ContextMenuEvent, noteId: string, parentNote: FNote) {
|
export function openCalendarContextMenu(e: ContextMenuEvent, noteId: string, parentNote: FNote) {
|
||||||
@ -18,8 +19,20 @@ export function openCalendarContextMenu(e: ContextMenuEvent, noteId: string, par
|
|||||||
title: t("calendar_view.delete_note"),
|
title: t("calendar_view.delete_note"),
|
||||||
uiIcon: "bx bx-trash",
|
uiIcon: "bx bx-trash",
|
||||||
handler: async () => {
|
handler: async () => {
|
||||||
const branchId = parentNote.childToBranch[noteId];
|
const noteToDelete = await froca.getNote(noteId);
|
||||||
await branches.deleteNotes([ branchId ], false, false);
|
if (!noteToDelete) return;
|
||||||
|
|
||||||
|
let branchIdToDelete: string | null = null;
|
||||||
|
for (const parentBranch of noteToDelete.getParentBranches()) {
|
||||||
|
const parentNote = await parentBranch.getNote();
|
||||||
|
if (parentNote?.hasAncestor(parentNote.noteId)) {
|
||||||
|
branchIdToDelete = parentBranch.branchId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (branchIdToDelete) {
|
||||||
|
await branches.deleteNotes([ branchIdToDelete ], false, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user