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