Fixed import of the clos into the operator

This commit is contained in:
FinnStutzenstein 2020-06-29 09:25:03 +02:00
parent fab51091b1
commit 4a96aa31c1
No known key found for this signature in database
GPG Key ID: 9042F605C6324654
2 changed files with 12 additions and 20 deletions

View File

@ -2,10 +2,9 @@ import { Injectable } from '@angular/core';
import { environment } from 'environments/environment'; import { environment } from 'environments/environment';
import { BehaviorSubject, Observable, Subscription } from 'rxjs'; 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 { 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 { ViewUser } from 'app/site/users/models/view-user';
import { CollectionStringMapperService } from './collection-string-mapper.service'; import { CollectionStringMapperService } from './collection-string-mapper.service';
import { DataStoreService } from './data-store.service'; import { DataStoreService } from './data-store.service';
@ -210,8 +209,7 @@ export class OperatorService implements OnAfterAppsLoaded {
private offlineService: OfflineService, private offlineService: OfflineService,
private collectionStringMapper: CollectionStringMapperService, private collectionStringMapper: CollectionStringMapperService,
private storageService: StorageService, private storageService: StorageService,
private OSStatus: OpenSlidesStatusService, private OSStatus: OpenSlidesStatusService
private closService: CurrentListOfSpeakersService
) { ) {
this.DS.getChangeObservable(User).subscribe(newModel => { this.DS.getChangeObservable(User).subscribe(newModel => {
if (this._user && this._user.id === newModel.id) { 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); await this.http.post(environment.urlPrefix + '/users/setpresence/', isPresent);
} }
public isOnCurrentListOfSpeakersObservable(): Observable<boolean> {
return this.closService.currentListOfSpeakersObservable.pipe(
map(los => {
if (los) {
return los.isUserOnList(this.user.id);
}
})
);
}
/** /**
* Returns a default WhoAmI response * Returns a default WhoAmI response
*/ */

View File

@ -4,7 +4,7 @@ import { Title } from '@angular/platform-browser';
import { StorageMap } from '@ngx-pwa/local-storage'; import { StorageMap } from '@ngx-pwa/local-storage';
import { TranslateService } from '@ngx-translate/core'; 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 { ConstantsService } from 'app/core/core-services/constants.service';
import { OperatorService } from 'app/core/core-services/operator.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 { UserRepositoryService } from 'app/core/repositories/users/user-repository.service';
import { ConfigService } from 'app/core/ui-services/config.service'; import { ConfigService } from 'app/core/ui-services/config.service';
import { BaseViewComponent } from 'app/site/base/base-view'; import { BaseViewComponent } from 'app/site/base/base-view';
import { CurrentListOfSpeakersService } from 'app/site/projector/services/current-list-of-speakers.service';
declare var JitsiMeetExternalAPI: any; declare var JitsiMeetExternalAPI: any;
@ -166,7 +167,8 @@ export class JitsiComponent extends BaseViewComponent implements OnInit, OnDestr
private storageMap: StorageMap, private storageMap: StorageMap,
private userRepo: UserRepositoryService, private userRepo: UserRepositoryService,
private constantsService: ConstantsService, private constantsService: ConstantsService,
private configService: ConfigService private configService: ConfigService,
private closService: CurrentListOfSpeakersService
) { ) {
super(titleService, translate, snackBar); super(titleService, translate, snackBar);
} }
@ -273,10 +275,12 @@ export class JitsiComponent extends BaseViewComponent implements OnInit, OnDestr
this.showJitsiWindow = true; this.showJitsiWindow = true;
} }
}), }),
// check if the user is on the clos, remove from room if not permitted // check if the operator is on the clos, remove from room if not permitted
this.operator this.closService.currentListOfSpeakersObservable
.isOnCurrentListOfSpeakersObservable() .pipe(
.pipe(distinctUntilChanged()) map(los => (los ? los.isUserOnList(this.operator.user.id) : false)),
distinctUntilChanged()
)
.subscribe(isOnList => { .subscribe(isOnList => {
this.isOnCurrentLos = isOnList; this.isOnCurrentLos = isOnList;
console.log('this.isOnCurrentLos: ', this.isOnCurrentLos); console.log('this.isOnCurrentLos: ', this.isOnCurrentLos);