GitLab steht aufgrund wichtiger Wartungsarbeiten am Montag, den 12. April, ab 19:00 Uhr nicht zur Verfügung.

Fixes duplicate availablequizzes dialog when logging out

parent a3d84d58
...@@ -132,13 +132,16 @@ export class HomeComponent implements OnInit, OnDestroy { ...@@ -132,13 +132,16 @@ export class HomeComponent implements OnInit, OnDestroy {
return; return;
} }
this.userService.loginNotifier.pipe(takeUntil(this._destroy)).subscribe(isLoggedIn => { this.userService.loginNotifier.pipe(takeUntil(this._destroy), distinctUntilChanged()).subscribe(isLoggedIn => {
this.updateFooterElements(isLoggedIn); this.updateFooterElements(isLoggedIn);
this.canModifyQuiz = !environment.requireLoginToCreateQuiz || (isLoggedIn && this.userService.isAuthorizedFor(UserRole.QuizAdmin)); this.canModifyQuiz = !environment.requireLoginToCreateQuiz || (isLoggedIn && this.userService.isAuthorizedFor(UserRole.QuizAdmin));
this.canUsePublicQuizzes = !environment.requireLoginToCreateQuiz || (isLoggedIn && this.userService.isAuthorizedFor(UserRole.CreateQuiz)); this.canUsePublicQuizzes = !environment.requireLoginToCreateQuiz || (isLoggedIn && this.userService.isAuthorizedFor(UserRole.CreateQuiz));
}); });
this.storageService.stateNotifier.pipe(takeUntil(this._destroy), filter(state => state === DbState.Initialized)).subscribe(state => { const params$ = this.activatedRoute.paramMap.pipe(distinctUntilChanged(), takeUntil(this._destroy));
const state$ = this.storageService.stateNotifier.pipe(filter(val => val !== DbState.Destroy), distinctUntilChanged(), takeUntil(this._destroy));
state$.pipe(filter(state => state === DbState.Initialized)).subscribe(() => {
this.cleanUpSessionStorage(); this.cleanUpSessionStorage();
this.storageService.db.getAllQuiznames().then(quizNames => { this.storageService.db.getAllQuiznames().then(quizNames => {
this._ownQuizzes = quizNames; this._ownQuizzes = quizNames;
...@@ -158,14 +161,9 @@ export class HomeComponent implements OnInit, OnDestroy { ...@@ -158,14 +161,9 @@ export class HomeComponent implements OnInit, OnDestroy {
this.ownPublicQuizAmount = val; this.ownPublicQuizAmount = val;
}); });
} }
}); });
const params$ = this.activatedRoute.paramMap.pipe(distinctUntilChanged(), takeUntil(this._destroy)); state$.pipe(switchMapTo(params$)).subscribe(async params => {
this.storageService.stateNotifier.pipe(filter(val => val !== DbState.Destroy),
distinctUntilChanged(), takeUntil(this._destroy), switchMapTo(params$)).subscribe(async params => {
if (!Object.keys(params).length || !params.get('themeId') || !params.get('languageId')) { if (!Object.keys(params).length || !params.get('themeId') || !params.get('languageId')) {
const theme = this.storageService.db.Config.get(StorageKey.DefaultTheme); const theme = this.storageService.db.Config.get(StorageKey.DefaultTheme);
if (!theme) { if (!theme) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment