From 4e975af91502798c8505e30482b1f91d82a3ed2d Mon Sep 17 00:00:00 2001 From: Sean Engelhardt Date: Mon, 25 Mar 2019 15:03:26 +0100 Subject: [PATCH] Fix history mode store access prevents local storage access from certain services when in history mode --- client/src/app/core/core-services/operator.service.ts | 9 +++++++-- .../src/app/core/core-services/time-travel.service.ts | 2 +- client/src/app/core/ui-services/login-data.service.ts | 11 +++++++++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/client/src/app/core/core-services/operator.service.ts b/client/src/app/core/core-services/operator.service.ts index 606e4d4de..b106e04ed 100644 --- a/client/src/app/core/core-services/operator.service.ts +++ b/client/src/app/core/core-services/operator.service.ts @@ -7,6 +7,7 @@ import { User } from '../../shared/models/users/user'; import { environment } from 'environments/environment'; import { DataStoreService } from './data-store.service'; import { OfflineService } from './offline.service'; +import { OpenSlidesStatusService } from './openslides-status.service'; import { ViewUser } from 'app/site/users/models/view-user'; import { OnAfterAppsLoaded } from '../onAfterAppsLoaded'; import { UserRepositoryService } from '../repositories/users/user-repository.service'; @@ -128,7 +129,8 @@ export class OperatorService implements OnAfterAppsLoaded { private DS: DataStoreService, private offlineService: OfflineService, private collectionStringMapper: CollectionStringMapperService, - private storageService: StorageService + private storageService: StorageService, + private OSStatus: OpenSlidesStatusService ) { this.DS.changeObservable.subscribe(newModel => { if (this._user && newModel instanceof User && this._user.id === newModel.id) { @@ -344,7 +346,10 @@ export class OperatorService implements OnAfterAppsLoaded { this.currentWhoAmI = this.getDefaultWhoAmIResponse(); } this.currentWhoAmI.permissions = this.permissions; - await this.storageService.set(WHOAMI_STORAGE_KEY, this.currentWhoAmI); + + if (!this.OSStatus.isInHistoryMode) { + await this.storageService.set(WHOAMI_STORAGE_KEY, this.currentWhoAmI); + } // publish changes in the operator. this.operatorSubject.next(this.user); diff --git a/client/src/app/core/core-services/time-travel.service.ts b/client/src/app/core/core-services/time-travel.service.ts index fcc823270..ae8fce4eb 100644 --- a/client/src/app/core/core-services/time-travel.service.ts +++ b/client/src/app/core/core-services/time-travel.service.ts @@ -82,9 +82,9 @@ export class TimeTravelService { * all missed auto updates are requested. */ public async resumeTime(): Promise { + this.OSStatus.leaveHistoryMode(); await this.DS.set(); await this.OpenSlides.reboot(); - this.OSStatus.leaveHistoryMode(); } /** diff --git a/client/src/app/core/ui-services/login-data.service.ts b/client/src/app/core/ui-services/login-data.service.ts index ac34c5319..b699897aa 100644 --- a/client/src/app/core/ui-services/login-data.service.ts +++ b/client/src/app/core/ui-services/login-data.service.ts @@ -4,6 +4,7 @@ import { BehaviorSubject, Observable } from 'rxjs'; import { ConfigService } from './config.service'; import { StorageService } from '../core-services/storage.service'; +import { OpenSlidesStatusService } from '../core-services/openslides-status.service'; /** * The login data send by the server. @@ -65,7 +66,11 @@ export class LoginDataService { * policy and legal notice, when their config values change. * @param configService */ - public constructor(private configService: ConfigService, private storageService: StorageService) { + public constructor( + private configService: ConfigService, + private storageService: StorageService, + private OSStatus: OpenSlidesStatusService + ) { this.configService.get('general_event_privacy_policy').subscribe(value => { this._privacy_policy.next(value); this.storeLoginData(); @@ -118,6 +123,8 @@ export class LoginDataService { theme: this._theme.getValue() }; } - this.storageService.set(LOGIN_DATA_STORAGE_KEY, loginData); + if (!this.OSStatus.isInHistoryMode) { + this.storageService.set(LOGIN_DATA_STORAGE_KEY, loginData); + } } }