diff --git a/client/src/app/site/modules/site-wrapper/services/voting-banner.service.ts b/client/src/app/site/modules/site-wrapper/services/voting-banner.service.ts index 8a1bf14bc3..cd18fb0361 100644 --- a/client/src/app/site/modules/site-wrapper/services/voting-banner.service.ts +++ b/client/src/app/site/modules/site-wrapper/services/voting-banner.service.ts @@ -68,7 +68,7 @@ export class VotingBannerService { } private updateBanner(polls: ViewPoll[], voted: { [key: Id]: Id[] }): void { - if (this.activeMeeting.meetingId && !this.operator.isAnonymous) { + if (this.activeMeeting.meetingId && !this.operator.isAnonymous && this.operator.readyDeferred.wasResolved) { const checkUsers = [this.operator.user, ...(this.operator.user.vote_delegations_from() || [])]; this.pollsToVote = polls.filter( poll => checkUsers.some(user => this.votingService.canVote(poll, user)) && voted[poll.id] !== undefined diff --git a/client/src/app/site/services/operator.service.ts b/client/src/app/site/services/operator.service.ts index 462a574af6..8c47ef7fb1 100644 --- a/client/src/app/site/services/operator.service.ts +++ b/client/src/app/site/services/operator.service.ts @@ -100,13 +100,19 @@ export class OperatorService { } public get isAnyManager(): boolean { - return this.isSuperAdmin || this.isOrgaManager || this.isCommitteeManager; + return this.isSuperAdmin || this.isOrgaManager || this.readyDeferred.wasResolved + ? this.isCommitteeManager + : false; } public get knowsMultipleMeetings(): boolean { return ( this.isAnyManager || - (this.isAnonymous ? this.defaultAnonUser.hasMultipleMeetings : this.user.hasMultipleMeetings) + (this.isAnonymous + ? this.defaultAnonUser.hasMultipleMeetings + : this.readyDeferred.wasResolved + ? this.user?.hasMultipleMeetings + : false) ); } @@ -164,7 +170,7 @@ export class OperatorService { } public get ready(): Deferred { - return this._readyDeferred; + return this.readyDeferred; } /** @@ -227,7 +233,7 @@ export class OperatorService { // State management private _ready = false; - private _readyDeferred: Deferred = new Deferred(); + public readyDeferred: Deferred = new Deferred(); private _groupsLoaded = false; private _groupsLoadedDeferred: Deferred = new Deferred(); @@ -436,7 +442,7 @@ export class OperatorService { this._permissions !== undefined; } if (this.isAuthenticated) { - isReady = isReady && this._OML !== undefined && this._CML !== undefined; + isReady = isReady && this._OML !== undefined && this._CML !== undefined && this._userSubject !== undefined; } // TODO: for developing some checks // console.log( @@ -457,7 +463,7 @@ export class OperatorService { // ); if (isReady) { this._ready = true; - this._readyDeferred.resolve(); + this.readyDeferred.resolve(); this._operatorReadySubject.next(true); } } @@ -465,14 +471,15 @@ export class OperatorService { private setNotReady(): void { this._ready = false; this._operatorReadySubject.next(false); - if (this._readyDeferred.wasResolved) { + if (this.readyDeferred.wasResolved) { console.log(`operator: not ready`); - this._readyDeferred = new Deferred(); - this._readyDeferred.then(() => console.log(`operator is ready!`)); + this.readyDeferred = new Deferred(); + this.readyDeferred.then(() => console.log(`operator is ready!`)); } } private resetOperatorData(): void { + this._userSubject.next(undefined); this._meetingIds = undefined; this._groupIds = undefined; this._permissions = undefined;