diff --git a/connect/communityGuard/connectCommunityGuard.guard.ts b/connect/communityGuard/connectCommunityGuard.guard.ts index 4a84c256..5190fa8e 100644 --- a/connect/communityGuard/connectCommunityGuard.guard.ts +++ b/connect/communityGuard/connectCommunityGuard.guard.ts @@ -1,5 +1,5 @@ -import {filter, mergeMap} from 'rxjs/operators'; +import {filter, map, mergeMap} from 'rxjs/operators'; import { Injectable } from '@angular/core'; import { Router, @@ -20,26 +20,19 @@ export class ConnectCommunityGuard implements CanActivate { sub: Subscription = null; constructor(private router: Router, - private communityService: CommunityService, - private propertiesService: EnvironmentSpecificService) { + private communityService: CommunityService) { } check(community: string): Observable | boolean { - const obs = this.communityService.isCommunityTypeByState(properties, properties['communityAPI'] + community); - - this.sub = obs.pipe(filter(enabled => !enabled)) - .subscribe(() => this.router.navigate(['errorcommunity'])); - return obs; + return this.communityService.isCommunityTypeByState(properties, properties['communityAPI'] + community).pipe(map(isCommunity => { + if(!isCommunity) { + this.router.navigate(['errorcommunity']); + } + return isCommunity; + })); } canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | boolean { return this.check(route.queryParams['communityId']); } - - canDeactivate() { - if(this.sub) { - this.sub.unsubscribe(); - } - return true; - } } diff --git a/dashboard/divhelpcontent/div-help-content-form.module.ts b/dashboard/divhelpcontent/div-help-content-form.module.ts index 421788a3..ca97501b 100644 --- a/dashboard/divhelpcontent/div-help-content-form.module.ts +++ b/dashboard/divhelpcontent/div-help-content-form.module.ts @@ -4,7 +4,7 @@ import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {AlertModalModule} from '../../utils/modal/alertModal.module'; import {SafeHtmlPipeModule} from '../../utils/pipes/safeHTMLPipe.module'; import {DivContentFormComponent} from './div-help-content-form.component'; -import {CKEditorModule} from 'ng2-ckeditor'; +import {CKEditorModule} from 'ckeditor4-angular'; @NgModule({ imports: [ diff --git a/dashboard/helpTexts/page-help-content-form.module.ts b/dashboard/helpTexts/page-help-content-form.module.ts index 66ce8814..cbf60894 100644 --- a/dashboard/helpTexts/page-help-content-form.module.ts +++ b/dashboard/helpTexts/page-help-content-form.module.ts @@ -3,7 +3,7 @@ import {CommonModule} from '@angular/common'; import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {AlertModalModule} from '../../utils/modal/alertModal.module'; import {SafeHtmlPipeModule} from '../../utils/pipes/safeHTMLPipe.module'; -import {CKEditorModule} from 'ng2-ckeditor'; +import {CKEditorModule} from 'ckeditor4-angular'; import {PageContentFormComponent} from './page-help-content-form.component'; @NgModule({