From c75364b47869d92d7f7c1b2731d36c60fdab0a3d Mon Sep 17 00:00:00 2001 From: kimyenac Date: Thu, 23 Jul 2026 09:46:07 +0900 Subject: [PATCH] [ZEPPELIN-6550] Fix trash detection in note view so trashed notes can be permanently deleted NoteStatusService.isTrash used note.name.split('/')[1], but since ZEPPELIN-4041 the backend sets Note.name to the last path segment only, so that index is always undefined and isTrash always returned false. The full path lives in note.path, which NoteListService already uses. As a result, opening a note from the Trash showed "Move to trash" (re-nesting it into /~Trash/~Trash/...) instead of "Remove permanently", and the cron scheduler button stayed enabled for trashed notes. - Use note.path instead of note.name in isTrash (mirrors NoteListService). - Navigate back to '/' after permanent delete, matching moveNoteToTrash, so the view leaves the now-deleted note instead of re-fetching it (404). Co-Authored-By: Claude Opus 4.8 (1M context) --- .../workspace/notebook/action-bar/action-bar.component.ts | 1 + .../src/app/services/note-status.service.ts | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/zeppelin-web-angular/src/app/pages/workspace/notebook/action-bar/action-bar.component.ts b/zeppelin-web-angular/src/app/pages/workspace/notebook/action-bar/action-bar.component.ts index 96ee1774e04..cab6895b9b1 100644 --- a/zeppelin-web-angular/src/app/pages/workspace/notebook/action-bar/action-bar.component.ts +++ b/zeppelin-web-angular/src/app/pages/workspace/notebook/action-bar/action-bar.component.ts @@ -268,6 +268,7 @@ export class NotebookActionBarComponent extends MessageListenersManager implemen deleteNote() { this.messageService.deleteNote(this.note.id); + this.router.navigate(['/']); } moveNoteToTrash() { diff --git a/zeppelin-web-angular/src/app/services/note-status.service.ts b/zeppelin-web-angular/src/app/services/note-status.service.ts index 153da21ca9a..adcd994c1b5 100644 --- a/zeppelin-web-angular/src/app/services/note-status.service.ts +++ b/zeppelin-web-angular/src/app/services/note-status.service.ts @@ -33,8 +33,10 @@ export class NoteStatusService { } isTrash(note: Exclude) { - // TODO(hsuanxyz) https://github.com/apache/zeppelin/pull/3365/files - return note.name.split('/')[1] === this.TRASH_FOLDER_ID; + // Detect trash by note.path, not note.name: the trash folder is the second + // path segment (see apache/zeppelin#3365), and since ZEPPELIN-4041 note.name + // holds only the last path segment. Mirrors NoteListService. + return note.path.split('/')[1] === this.TRASH_FOLDER_ID; } viewOnly(note: Exclude): boolean {