From 3fad8cce74e272b2f6525996513870e902f2bcbe Mon Sep 17 00:00:00 2001 From: Dominik Iwanek <141320833+dominikiwanekhyland@users.noreply.github.com> Date: Tue, 27 Jan 2026 09:15:47 +0100 Subject: [PATCH] [ACS-10307] SR: Personal files: No confirmation announced when creating new folder or document (#5006) --- projects/aca-content/assets/i18n/en.json | 4 +++ .../store/effects/template.effects.spec.ts | 30 +++++++++++++++++++ .../src/lib/store/effects/template.effects.ts | 7 ++++- 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/projects/aca-content/assets/i18n/en.json b/projects/aca-content/assets/i18n/en.json index 7ea1f0e17..97832b374 100644 --- a/projects/aca-content/assets/i18n/en.json +++ b/projects/aca-content/assets/i18n/en.json @@ -433,6 +433,10 @@ "FAIL": "{{ failed }} couldn't be moved." } }, + "NODE_CREATE": { + "FILE_FROM_TEMPLATE_SUCCESS": "File {{ name }} created from template", + "FOLDER_FROM_TEMPLATE_SUCCESS": "Folder {{ name }} created from template" + }, "LIBRARY_DELETED": "Library deleted", "LEFT_LIBRARY": "You have left the library", "FAVORITE_NODE_ADDED": "Added {{ name }} to favorites", diff --git a/projects/aca-content/src/lib/store/effects/template.effects.spec.ts b/projects/aca-content/src/lib/store/effects/template.effects.spec.ts index f544aab23..a328b2dae 100644 --- a/projects/aca-content/src/lib/store/effects/template.effects.spec.ts +++ b/projects/aca-content/src/lib/store/effects/template.effects.spec.ts @@ -46,6 +46,7 @@ describe('TemplateEffects', () => { let updateNodeSpy; let matDialog: MatDialog; let showErrorSpy; + let showInfoSpy; const node: Node = { name: 'node-name', @@ -98,6 +99,7 @@ describe('TemplateEffects', () => { const notificationService = TestBed.inject(NotificationService); showErrorSpy = spyOn(notificationService, 'showError'); + showInfoSpy = spyOn(notificationService, 'showInfo'); spyOn(store, 'dispatch').and.callThrough(); spyOn(documentListService, 'reload').and.stub(); @@ -215,4 +217,32 @@ describe('TemplateEffects', () => { tick(); expect(documentListService.reload).toHaveBeenCalled(); })); + + it('should show success notification for file created from template', fakeAsync(() => { + const fileNode: Node = { + id: 'file-node-id', + name: 'test-file.txt', + isFolder: false, + isFile: true + } as Node; + + store.dispatch(new CreateFromTemplateSuccess(fileNode)); + tick(); + + expect(showInfoSpy).toHaveBeenCalledWith('APP.MESSAGES.INFO.NODE_CREATE.FILE_FROM_TEMPLATE_SUCCESS', null, { name: 'test-file.txt' }); + })); + + it('should show success notification for folder created from template', fakeAsync(() => { + const folderNode: Node = { + id: 'folder-node-id', + name: 'test-folder', + isFolder: true, + isFile: false + } as Node; + + store.dispatch(new CreateFromTemplateSuccess(folderNode)); + tick(); + + expect(showInfoSpy).toHaveBeenCalledWith('APP.MESSAGES.INFO.NODE_CREATE.FOLDER_FROM_TEMPLATE_SUCCESS', null, { name: 'test-folder' }); + })); }); diff --git a/projects/aca-content/src/lib/store/effects/template.effects.ts b/projects/aca-content/src/lib/store/effects/template.effects.ts index 36cb8b4d0..63f8269b8 100644 --- a/projects/aca-content/src/lib/store/effects/template.effects.ts +++ b/projects/aca-content/src/lib/store/effects/template.effects.ts @@ -112,7 +112,12 @@ export class TemplateEffects { () => this.actions$.pipe( ofType(TemplateActionTypes.CreateFromTemplateSuccess), - map(() => { + map((action) => { + const node = action.node; + const messageKey = node.isFolder + ? 'APP.MESSAGES.INFO.NODE_CREATE.FOLDER_FROM_TEMPLATE_SUCCESS' + : 'APP.MESSAGES.INFO.NODE_CREATE.FILE_FROM_TEMPLATE_SUCCESS'; + this.notificationService.showInfo(messageKey, null, { name: node.name }); this.matDialog.closeAll(); this.documentListService.reload(); })