Remove trash success notifications (#19534)

* remove trash notifications

* Updated tests so we no longer use the notification for moving to recycle bin

---------

Co-authored-by: Andreas Zerbst <andr317c@live.dk>
This commit is contained in:
Mads Rasmussen
2025-06-27 13:31:08 +02:00
committed by GitHub
parent e3c52afbbb
commit 5cafa599fa
3 changed files with 12 additions and 28 deletions

View File

@@ -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();
}

View File

@@ -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);
});
});

View File

@@ -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();