From 7daa21ec6c4b2c03fdea4ccd8d405816ec42702c Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Thu, 12 Jun 2025 10:22:35 +0200 Subject: [PATCH 1/2] remove trash notifications --- .../recycle-bin-repository-base.ts | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/recycle-bin/recycle-bin-repository-base.ts b/src/Umbraco.Web.UI.Client/src/packages/core/recycle-bin/recycle-bin-repository-base.ts index e246dac49d33..f91742f0f372 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/recycle-bin/recycle-bin-repository-base.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/recycle-bin/recycle-bin-repository-base.ts @@ -23,7 +23,6 @@ import { UmbRepositoryBase } from '@umbraco-cms/backoffice/repository'; export abstract class UmbRecycleBinRepositoryBase extends UmbRepositoryBase implements UmbRecycleBinRepository { #recycleBinSource: UmbRecycleBinDataSource; #notificationContext?: typeof UMB_NOTIFICATION_CONTEXT.TYPE; - #requestTrashSuccessNotification?: UmbNotificationHandler; #requestRestoreSuccessNotification?: UmbNotificationHandler; /** @@ -48,15 +47,7 @@ export abstract class UmbRecycleBinRepositoryBase extends UmbRepositoryBase impl * @memberof UmbRecycleBinRepositoryBase */ async requestTrash(args: UmbRecycleBinTrashRequestArgs) { - const { error } = await this.#recycleBinSource.trash(args); - - if (!error) { - this.#requestTrashSuccessNotification?.close(); - const notification = { data: { message: `Trashed` } }; - this.#requestTrashSuccessNotification = this.#notificationContext?.peek('positive', notification); - } - - return { error }; + return this.#recycleBinSource.trash(args); } /** @@ -69,6 +60,7 @@ export abstract class UmbRecycleBinRepositoryBase extends UmbRepositoryBase impl const { error } = await this.#recycleBinSource.restore(args); if (!error) { + // TODO: keep this notification until we refresh the tree/structure correctly after the action this.#requestRestoreSuccessNotification?.close(); const notification = { data: { message: `Restored` } }; this.#requestRestoreSuccessNotification = this.#notificationContext?.peek('positive', notification); @@ -83,13 +75,6 @@ export abstract class UmbRecycleBinRepositoryBase extends UmbRepositoryBase impl * @memberof UmbRecycleBinRepositoryBase */ async requestEmpty() { - const { error } = await this.#recycleBinSource.empty(); - - if (!error) { - const notification = { data: { message: `Recycle Bin Emptied` } }; - this.#notificationContext?.peek('positive', notification); - } - return this.#recycleBinSource.empty(); } From af823d8e0319670db70716da7be46f1a02c4c664 Mon Sep 17 00:00:00 2001 From: Andreas Zerbst Date: Mon, 23 Jun 2025 10:44:52 +0200 Subject: [PATCH 2/2] Updated tests so we no longer use the notification for moving to recycle bin --- .../Content/TrashContent/TrashContent.spec.ts | 19 ++++++++++--------- .../tests/DefaultConfig/Media/Media.spec.ts | 2 -- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/TrashContent/TrashContent.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/TrashContent/TrashContent.spec.ts index 0d3c85414137..f65a686143f5 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/TrashContent/TrashContent.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/TrashContent/TrashContent.spec.ts @@ -37,7 +37,7 @@ test('can trash an invariant content node', {tag: '@smoke'}, async ({umbracoApi, await umbracoUi.content.clickConfirmTrashButton(); // Assert - await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.movedToRecycleBin); + await umbracoUi.content.waitForContentToBeTrashed(); expect(await umbracoApi.document.doesNameExist(contentName)).toBeFalsy(); await umbracoUi.content.isItemVisibleInRecycleBin(contentName); expect(await umbracoApi.document.doesItemExistInRecycleBin(contentName)).toBeTruthy(); @@ -58,7 +58,7 @@ test('can trash a variant content node', async ({umbracoApi, umbracoUi}) => { await umbracoUi.content.clickConfirmTrashButton(); // Assert - await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.movedToRecycleBin); + await umbracoUi.content.waitForContentToBeTrashed(); expect(await umbracoApi.document.doesNameExist(contentName)).toBeFalsy(); await umbracoUi.content.isItemVisibleInRecycleBin(contentName); expect(await umbracoApi.document.doesItemExistInRecycleBin(contentName)).toBeTruthy(); @@ -80,7 +80,7 @@ test('can trash a published content node', async ({umbracoApi, umbracoUi}) => { await umbracoUi.content.clickConfirmTrashButton(); // Assert - await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.movedToRecycleBin); + await umbracoUi.content.waitForContentToBeTrashed(); expect(await umbracoApi.document.doesNameExist(contentName)).toBeFalsy(); await umbracoUi.content.isItemVisibleInRecycleBin(contentName); expect(await umbracoApi.document.doesItemExistInRecycleBin(contentName)).toBeTruthy(); @@ -107,7 +107,7 @@ test('can trash an invariant content node that references one item', async ({umb await umbracoUi.content.clickConfirmTrashButton(); // Assert - await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.movedToRecycleBin); + await umbracoUi.content.waitForContentToBeTrashed(); expect(await umbracoApi.document.doesNameExist(contentName)).toBeFalsy(); await umbracoUi.content.isItemVisibleInRecycleBin(contentName); expect(await umbracoApi.document.doesItemExistInRecycleBin(contentName)).toBeTruthy(); @@ -134,7 +134,7 @@ test('can trash a variant content node that references one item', async ({umbrac await umbracoUi.content.clickConfirmTrashButton(); // Assert - await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.movedToRecycleBin); + await umbracoUi.content.waitForContentToBeTrashed(); expect(await umbracoApi.document.doesNameExist(contentName)).toBeFalsy(); await umbracoUi.content.isItemVisibleInRecycleBin(contentName); expect(await umbracoApi.document.doesItemExistInRecycleBin(contentName)).toBeTruthy(); @@ -170,7 +170,7 @@ test('can trash an invariant content node that references more than 3 items', as await umbracoUi.content.clickConfirmTrashButton(); // Assert - await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.movedToRecycleBin); + await umbracoUi.content.waitForContentToBeTrashed(); expect(await umbracoApi.document.doesNameExist(contentName)).toBeFalsy(); await umbracoUi.content.isItemVisibleInRecycleBin(contentName); expect(await umbracoApi.document.doesItemExistInRecycleBin(contentName)).toBeTruthy(); @@ -211,7 +211,7 @@ test('can trash a variant content node that references more than 3 items', async await umbracoUi.content.clickConfirmTrashButton(); // Assert - await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.movedToRecycleBin); + await umbracoUi.content.waitForContentToBeTrashed(); expect(await umbracoApi.document.doesNameExist(contentName)).toBeFalsy(); await umbracoUi.content.isItemVisibleInRecycleBin(contentName); expect(await umbracoApi.document.doesItemExistInRecycleBin(contentName)).toBeTruthy(); @@ -226,6 +226,7 @@ test('can trash a content node with multiple cultures that references one item', // Arrange const firstCulture = 'en-US'; const secondCulture = 'da'; + await umbracoApi.language.ensureIsoCodeNotExists(secondCulture); await umbracoApi.language.createDanishLanguage(); // Create a content node with multiple cultures const documentTypeId = await umbracoApi.documentType.createVariantDocumentTypeWithInvariantPropertyEditor(documentTypeName, dataTypeName, dataTypeId); @@ -247,11 +248,11 @@ test('can trash a content node with multiple cultures that references one item', await umbracoUi.content.clickConfirmTrashButton(); // Assert - await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.movedToRecycleBin); + await umbracoUi.content.waitForContentToBeTrashed(); expect(await umbracoApi.document.doesNameExist(contentName)).toBeFalsy(); await umbracoUi.content.isItemVisibleInRecycleBin(contentName); expect(await umbracoApi.document.doesItemExistInRecycleBin(contentName)).toBeTruthy(); // Clean await umbracoApi.language.ensureIsoCodeNotExists(secondCulture); -}); \ No newline at end of file +}); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Media/Media.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Media/Media.spec.ts index b1c4d9b1e6e5..ada2e6f149fe 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Media/Media.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Media/Media.spec.ts @@ -116,7 +116,6 @@ test('can trash a folder', async ({umbracoApi, umbracoUi}) => { // Assert await umbracoUi.media.waitForMediaToBeTrashed(); - await umbracoUi.media.doesSuccessNotificationHaveText(NotificationConstantHelper.success.movedToRecycleBin); await umbracoUi.media.isTreeItemVisible(folderName, false); await umbracoUi.media.isItemVisibleInRecycleBin(folderName); expect(await umbracoApi.media.doesNameExist(folderName)).toBeFalsy(); @@ -180,7 +179,6 @@ test('can trash a media item', async ({umbracoApi, umbracoUi}) => { // Assert await umbracoUi.media.waitForMediaToBeTrashed(); - await umbracoUi.media.doesSuccessNotificationHaveText(NotificationConstantHelper.success.movedToRecycleBin); await umbracoUi.media.isMediaTreeItemVisible(mediaFileName, false); await umbracoUi.media.isItemVisibleInRecycleBin(mediaFileName); expect(await umbracoApi.media.doesNameExist(mediaFileName)).toBeFalsy();