diff --git a/e2e/suites/list-views/generic-errors.test.ts b/e2e/suites/list-views/generic-errors.test.ts index b572bb43f..7f5690c17 100755 --- a/e2e/suites/list-views/generic-errors.test.ts +++ b/e2e/suites/list-views/generic-errors.test.ts @@ -72,14 +72,14 @@ describe('Generic errors', () => { await browser.get(URL); expect(await page.isGenericErrorDisplayed()).toBe(true, 'Generic error page not displayed'); - expect(await page.getGenericErrorTitle()).toContain(`This file or folder no longer exists or you don't have permission to view it.`); + expect(await page.getGenericErrorTitle()).toContain(`This item no longer exists or you don't have permission to view it.`); }); it('Invalid URL - [C217315]', async () => { await page.load('/invalid page'); expect(await page.isGenericErrorDisplayed()).toBe(true, 'Generic error page not displayed'); - expect(await page.getGenericErrorTitle()).toContain(`This file or folder no longer exists or you don't have permission to view it.`); + expect(await page.getGenericErrorTitle()).toContain(`This item no longer exists or you don't have permission to view it.`); }); @@ -92,7 +92,7 @@ describe('Generic errors', () => { await browser.get(URL); expect(await page.isGenericErrorDisplayed()).toBe(true, 'Generic error page not displayed'); - expect(await page.getGenericErrorTitle()).toContain(`This file or folder no longer exists or you don't have permission to view it.`); + expect(await page.getGenericErrorTitle()).toContain(`This item no longer exists or you don't have permission to view it.`); await loginPage.loginWith(username); }); diff --git a/src/app/components/favorite-libraries/favorite-libraries.component.spec.ts b/src/app/components/favorite-libraries/favorite-libraries.component.spec.ts index d43acb835..646fd5420 100644 --- a/src/app/components/favorite-libraries/favorite-libraries.component.spec.ts +++ b/src/app/components/favorite-libraries/favorite-libraries.component.spec.ts @@ -41,10 +41,10 @@ import { ContentApiService } from '../../services/content-api.service'; import { ExperimentalDirective } from '../../directives/experimental.directive'; import { ContentManagementService } from '../../services/content-management.service'; import { EffectsModule } from '@ngrx/effects'; -import { LibraryEffects } from '../../store/effects'; +import { LibraryEffects, RouterEffects } from '../../store/effects'; import { of } from 'rxjs'; -describe('LibrariesComponent', () => { +describe('FavoriteLibrariesComponent', () => { let fixture: ComponentFixture; let component: FavoriteLibrariesComponent; let alfrescoApi: AlfrescoApiService; @@ -64,7 +64,10 @@ describe('LibrariesComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [AppTestingModule, EffectsModule.forRoot([LibraryEffects])], + imports: [ + AppTestingModule, + EffectsModule.forRoot([RouterEffects, LibraryEffects]) + ], declarations: [ DataTableComponent, TimeAgoPipe, diff --git a/src/app/store/effects/library.effects.ts b/src/app/store/effects/library.effects.ts index f432fa3b8..1e9c66bae 100644 --- a/src/app/store/effects/library.effects.ts +++ b/src/app/store/effects/library.effects.ts @@ -36,15 +36,16 @@ import { UpdateLibraryAction, UPDATE_LIBRARY, LeaveLibraryAction, - LEAVE_LIBRARY + LEAVE_LIBRARY, + NavigateRouteAction } from '../actions'; import { ContentManagementService } from '../../services/content-management.service'; import { Store } from '@ngrx/store'; import { AppStore } from '../states'; import { appSelection } from '../selectors/app.selectors'; import { ContentApiService } from '../../services/content-api.service'; -import { Router } from '@angular/router'; import { SiteBody } from 'alfresco-js-api-node'; +import { SnackbarErrorAction } from '../actions/snackbar.actions'; @Injectable() export class LibraryEffects { @@ -52,8 +53,7 @@ export class LibraryEffects { private store: Store, private actions$: Actions, private content: ContentManagementService, - private contentApi: ContentApiService, - private router: Router + private contentApi: ContentApiService ) {} @Effect({ dispatch: false }) @@ -109,10 +109,17 @@ export class LibraryEffects { if (libraryId) { this.contentApi .getNode(libraryId, { relativePath: '/documentLibrary' }) - .pipe(map(node => node.entry)) - .subscribe(documentLibrary => { - this.router.navigate(['libraries', documentLibrary.id]); - }); + .pipe(map(node => node.entry.id)) + .subscribe( + id => { + this.store.dispatch(new NavigateRouteAction(['libraries', id])); + }, + () => { + this.store.dispatch( + new SnackbarErrorAction('APP.MESSAGES.ERRORS.MISSING_CONTENT') + ); + } + ); } }) ); diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index b1932624f..ee3d8c657 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -250,7 +250,7 @@ }, "MESSAGES": { "ERRORS":{ - "MISSING_CONTENT": "This file or folder no longer exists or you don't have permission to view it.", + "MISSING_CONTENT": "This item no longer exists or you don't have permission to view it.", "GENERIC": "The action was unsuccessful. Try again or contact your IT Team.", "CONFLICT": "This name is already in use, try a different name.", "NODE_MOVE": "Move unsuccessful, a file with the same name already exists.",