[ACA-1991] correctly show error for moderated libraries (#823)

* correctly show error for moderated libraries

* fix unit test

* update e2e tests
This commit is contained in:
Denys Vuika 2018-11-23 15:24:33 +00:00 committed by GitHub
parent 13db4fb339
commit 0b0a2ad75c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 15 deletions

View File

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

View File

@ -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<FavoriteLibrariesComponent>;
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,

View File

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

View File

@ -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.",