From 4a96aa31c179eec3bf04133226318b2110cbbe2d Mon Sep 17 00:00:00 2001 From: FinnStutzenstein Date: Mon, 29 Jun 2020 09:25:03 +0200 Subject: [PATCH] Fixed import of the clos into the operator --- .../app/core/core-services/operator.service.ts | 16 ++-------------- .../shared/components/jitsi/jitsi.component.ts | 16 ++++++++++------ 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/client/src/app/core/core-services/operator.service.ts b/client/src/app/core/core-services/operator.service.ts index 51d374268..818e7e642 100644 --- a/client/src/app/core/core-services/operator.service.ts +++ b/client/src/app/core/core-services/operator.service.ts @@ -2,10 +2,9 @@ import { Injectable } from '@angular/core'; import { environment } from 'environments/environment'; import { BehaviorSubject, Observable, Subscription } from 'rxjs'; -import { auditTime, filter, map } from 'rxjs/operators'; +import { auditTime, filter } from 'rxjs/operators'; import { Group } from 'app/shared/models/users/group'; -import { CurrentListOfSpeakersService } from 'app/site/projector/services/current-list-of-speakers.service'; import { ViewUser } from 'app/site/users/models/view-user'; import { CollectionStringMapperService } from './collection-string-mapper.service'; import { DataStoreService } from './data-store.service'; @@ -210,8 +209,7 @@ export class OperatorService implements OnAfterAppsLoaded { private offlineService: OfflineService, private collectionStringMapper: CollectionStringMapperService, private storageService: StorageService, - private OSStatus: OpenSlidesStatusService, - private closService: CurrentListOfSpeakersService + private OSStatus: OpenSlidesStatusService ) { this.DS.getChangeObservable(User).subscribe(newModel => { if (this._user && this._user.id === newModel.id) { @@ -462,16 +460,6 @@ export class OperatorService implements OnAfterAppsLoaded { await this.http.post(environment.urlPrefix + '/users/setpresence/', isPresent); } - public isOnCurrentListOfSpeakersObservable(): Observable { - return this.closService.currentListOfSpeakersObservable.pipe( - map(los => { - if (los) { - return los.isUserOnList(this.user.id); - } - }) - ); - } - /** * Returns a default WhoAmI response */ diff --git a/client/src/app/shared/components/jitsi/jitsi.component.ts b/client/src/app/shared/components/jitsi/jitsi.component.ts index f1b9a7327..dfa8a9deb 100644 --- a/client/src/app/shared/components/jitsi/jitsi.component.ts +++ b/client/src/app/shared/components/jitsi/jitsi.component.ts @@ -4,7 +4,7 @@ import { Title } from '@angular/platform-browser'; import { StorageMap } from '@ngx-pwa/local-storage'; import { TranslateService } from '@ngx-translate/core'; -import { distinctUntilChanged } from 'rxjs/operators'; +import { distinctUntilChanged, map } from 'rxjs/operators'; import { ConstantsService } from 'app/core/core-services/constants.service'; import { OperatorService } from 'app/core/core-services/operator.service'; @@ -12,6 +12,7 @@ import { Deferred } from 'app/core/promises/deferred'; import { UserRepositoryService } from 'app/core/repositories/users/user-repository.service'; import { ConfigService } from 'app/core/ui-services/config.service'; import { BaseViewComponent } from 'app/site/base/base-view'; +import { CurrentListOfSpeakersService } from 'app/site/projector/services/current-list-of-speakers.service'; declare var JitsiMeetExternalAPI: any; @@ -166,7 +167,8 @@ export class JitsiComponent extends BaseViewComponent implements OnInit, OnDestr private storageMap: StorageMap, private userRepo: UserRepositoryService, private constantsService: ConstantsService, - private configService: ConfigService + private configService: ConfigService, + private closService: CurrentListOfSpeakersService ) { super(titleService, translate, snackBar); } @@ -273,10 +275,12 @@ export class JitsiComponent extends BaseViewComponent implements OnInit, OnDestr this.showJitsiWindow = true; } }), - // check if the user is on the clos, remove from room if not permitted - this.operator - .isOnCurrentListOfSpeakersObservable() - .pipe(distinctUntilChanged()) + // check if the operator is on the clos, remove from room if not permitted + this.closService.currentListOfSpeakersObservable + .pipe( + map(los => (los ? los.isUserOnList(this.operator.user.id) : false)), + distinctUntilChanged() + ) .subscribe(isOnList => { this.isOnCurrentLos = isOnList; console.log('this.isOnCurrentLos: ', this.isOnCurrentLos);