+ private async openModalsIfNeeded () {
+ this.serverService.configLoaded
+ .pipe(
+ switchMap(() => this.authService.userInformationLoaded),
+ map(() => this.authService.getUser()),
+ filter(user => user.role === UserRole.ADMINISTRATOR)
+ ).subscribe(user => setTimeout(() => this.openAdminModals(user))) // setTimeout because of ngIf in template
+ }
+
+ private async openAdminModals (user: User) {
+ if (user.noWelcomeModal !== true) return this.welcomeModal.show()
+
+ const config = this.serverService.getConfig()
+ if (user.noInstanceConfigWarningModal === true || !config.signup.allowed) return
+
+ this.instanceService.getAbout()
+ .subscribe(about => {
+ if (
+ config.instance.name.toLowerCase() === 'peertube' ||
+ !about.instance.terms ||
+ !about.instance.administrator ||
+ !about.instance.maintenanceLifetime
+ ) {
+ this.instanceConfigWarningModal.show(about)
+ }
+ })
+ }
+