Skip to content

Commit 5cafa59

Browse files
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>
1 parent e3c52af commit 5cafa59

File tree

3 files changed

+12
-28
lines changed

3 files changed

+12
-28
lines changed

src/Umbraco.Web.UI.Client/src/packages/core/recycle-bin/recycle-bin-repository-base.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import { UmbRepositoryBase } from '@umbraco-cms/backoffice/repository';
2323
export abstract class UmbRecycleBinRepositoryBase extends UmbRepositoryBase implements UmbRecycleBinRepository {
2424
#recycleBinSource: UmbRecycleBinDataSource;
2525
#notificationContext?: typeof UMB_NOTIFICATION_CONTEXT.TYPE;
26-
#requestTrashSuccessNotification?: UmbNotificationHandler;
2726
#requestRestoreSuccessNotification?: UmbNotificationHandler;
2827

2928
/**
@@ -48,15 +47,7 @@ export abstract class UmbRecycleBinRepositoryBase extends UmbRepositoryBase impl
4847
* @memberof UmbRecycleBinRepositoryBase
4948
*/
5049
async requestTrash(args: UmbRecycleBinTrashRequestArgs) {
51-
const { error } = await this.#recycleBinSource.trash(args);
52-
53-
if (!error) {
54-
this.#requestTrashSuccessNotification?.close();
55-
const notification = { data: { message: `Trashed` } };
56-
this.#requestTrashSuccessNotification = this.#notificationContext?.peek('positive', notification);
57-
}
58-
59-
return { error };
50+
return this.#recycleBinSource.trash(args);
6051
}
6152

6253
/**
@@ -69,6 +60,7 @@ export abstract class UmbRecycleBinRepositoryBase extends UmbRepositoryBase impl
6960
const { error } = await this.#recycleBinSource.restore(args);
7061

7162
if (!error) {
63+
// TODO: keep this notification until we refresh the tree/structure correctly after the action
7264
this.#requestRestoreSuccessNotification?.close();
7365
const notification = { data: { message: `Restored` } };
7466
this.#requestRestoreSuccessNotification = this.#notificationContext?.peek('positive', notification);
@@ -83,13 +75,6 @@ export abstract class UmbRecycleBinRepositoryBase extends UmbRepositoryBase impl
8375
* @memberof UmbRecycleBinRepositoryBase
8476
*/
8577
async requestEmpty() {
86-
const { error } = await this.#recycleBinSource.empty();
87-
88-
if (!error) {
89-
const notification = { data: { message: `Recycle Bin Emptied` } };
90-
this.#notificationContext?.peek('positive', notification);
91-
}
92-
9378
return this.#recycleBinSource.empty();
9479
}
9580

tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/TrashContent/TrashContent.spec.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ test('can trash an invariant content node', {tag: '@smoke'}, async ({umbracoApi,
3737
await umbracoUi.content.clickConfirmTrashButton();
3838

3939
// Assert
40-
await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.movedToRecycleBin);
40+
await umbracoUi.content.waitForContentToBeTrashed();
4141
expect(await umbracoApi.document.doesNameExist(contentName)).toBeFalsy();
4242
await umbracoUi.content.isItemVisibleInRecycleBin(contentName);
4343
expect(await umbracoApi.document.doesItemExistInRecycleBin(contentName)).toBeTruthy();
@@ -58,7 +58,7 @@ test('can trash a variant content node', async ({umbracoApi, umbracoUi}) => {
5858
await umbracoUi.content.clickConfirmTrashButton();
5959

6060
// Assert
61-
await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.movedToRecycleBin);
61+
await umbracoUi.content.waitForContentToBeTrashed();
6262
expect(await umbracoApi.document.doesNameExist(contentName)).toBeFalsy();
6363
await umbracoUi.content.isItemVisibleInRecycleBin(contentName);
6464
expect(await umbracoApi.document.doesItemExistInRecycleBin(contentName)).toBeTruthy();
@@ -80,7 +80,7 @@ test('can trash a published content node', async ({umbracoApi, umbracoUi}) => {
8080
await umbracoUi.content.clickConfirmTrashButton();
8181

8282
// Assert
83-
await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.movedToRecycleBin);
83+
await umbracoUi.content.waitForContentToBeTrashed();
8484
expect(await umbracoApi.document.doesNameExist(contentName)).toBeFalsy();
8585
await umbracoUi.content.isItemVisibleInRecycleBin(contentName);
8686
expect(await umbracoApi.document.doesItemExistInRecycleBin(contentName)).toBeTruthy();
@@ -107,7 +107,7 @@ test('can trash an invariant content node that references one item', async ({umb
107107
await umbracoUi.content.clickConfirmTrashButton();
108108

109109
// Assert
110-
await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.movedToRecycleBin);
110+
await umbracoUi.content.waitForContentToBeTrashed();
111111
expect(await umbracoApi.document.doesNameExist(contentName)).toBeFalsy();
112112
await umbracoUi.content.isItemVisibleInRecycleBin(contentName);
113113
expect(await umbracoApi.document.doesItemExistInRecycleBin(contentName)).toBeTruthy();
@@ -134,7 +134,7 @@ test('can trash a variant content node that references one item', async ({umbrac
134134
await umbracoUi.content.clickConfirmTrashButton();
135135

136136
// Assert
137-
await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.movedToRecycleBin);
137+
await umbracoUi.content.waitForContentToBeTrashed();
138138
expect(await umbracoApi.document.doesNameExist(contentName)).toBeFalsy();
139139
await umbracoUi.content.isItemVisibleInRecycleBin(contentName);
140140
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
170170
await umbracoUi.content.clickConfirmTrashButton();
171171

172172
// Assert
173-
await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.movedToRecycleBin);
173+
await umbracoUi.content.waitForContentToBeTrashed();
174174
expect(await umbracoApi.document.doesNameExist(contentName)).toBeFalsy();
175175
await umbracoUi.content.isItemVisibleInRecycleBin(contentName);
176176
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
211211
await umbracoUi.content.clickConfirmTrashButton();
212212

213213
// Assert
214-
await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.movedToRecycleBin);
214+
await umbracoUi.content.waitForContentToBeTrashed();
215215
expect(await umbracoApi.document.doesNameExist(contentName)).toBeFalsy();
216216
await umbracoUi.content.isItemVisibleInRecycleBin(contentName);
217217
expect(await umbracoApi.document.doesItemExistInRecycleBin(contentName)).toBeTruthy();
@@ -226,6 +226,7 @@ test('can trash a content node with multiple cultures that references one item',
226226
// Arrange
227227
const firstCulture = 'en-US';
228228
const secondCulture = 'da';
229+
await umbracoApi.language.ensureIsoCodeNotExists(secondCulture);
229230
await umbracoApi.language.createDanishLanguage();
230231
// Create a content node with multiple cultures
231232
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',
247248
await umbracoUi.content.clickConfirmTrashButton();
248249

249250
// Assert
250-
await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.movedToRecycleBin);
251+
await umbracoUi.content.waitForContentToBeTrashed();
251252
expect(await umbracoApi.document.doesNameExist(contentName)).toBeFalsy();
252253
await umbracoUi.content.isItemVisibleInRecycleBin(contentName);
253254
expect(await umbracoApi.document.doesItemExistInRecycleBin(contentName)).toBeTruthy();
254255

255256
// Clean
256257
await umbracoApi.language.ensureIsoCodeNotExists(secondCulture);
257-
});
258+
});

tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Media/Media.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ test('can trash a folder', async ({umbracoApi, umbracoUi}) => {
116116

117117
// Assert
118118
await umbracoUi.media.waitForMediaToBeTrashed();
119-
await umbracoUi.media.doesSuccessNotificationHaveText(NotificationConstantHelper.success.movedToRecycleBin);
120119
await umbracoUi.media.isTreeItemVisible(folderName, false);
121120
await umbracoUi.media.isItemVisibleInRecycleBin(folderName);
122121
expect(await umbracoApi.media.doesNameExist(folderName)).toBeFalsy();
@@ -180,7 +179,6 @@ test('can trash a media item', async ({umbracoApi, umbracoUi}) => {
180179

181180
// Assert
182181
await umbracoUi.media.waitForMediaToBeTrashed();
183-
await umbracoUi.media.doesSuccessNotificationHaveText(NotificationConstantHelper.success.movedToRecycleBin);
184182
await umbracoUi.media.isMediaTreeItemVisible(mediaFileName, false);
185183
await umbracoUi.media.isItemVisibleInRecycleBin(mediaFileName);
186184
expect(await umbracoApi.media.doesNameExist(mediaFileName)).toBeFalsy();

0 commit comments

Comments
 (0)