import { AuthService, RedirectService, ServerService, ThemeService } from '@app/core'
import { is18nPath } from '../../../shared/models/i18n'
import { ScreenService } from '@app/shared/misc/screen.service'
-import { debounceTime, filter, map, pairwise, skip, switchMap } from 'rxjs/operators'
+import { debounceTime, filter, first, map, pairwise, skip, switchMap } from 'rxjs/operators'
import { Hotkey, HotkeysService } from 'angular2-hotkeys'
import { I18n } from '@ngx-translate/i18n-polyfill'
import { fromEvent } from 'rxjs'
ngOnInit () {
document.getElementById('incompatible-browser').className += ' browser-ok'
+ this.loadPlugins()
+ this.themeService.initialize()
+
this.authService.loadClientCredentials()
if (this.isUserLoggedIn()) {
this.serverService.loadVideoPrivacies()
this.serverService.loadVideoPlaylistPrivacies()
- this.loadPlugins()
- this.themeService.initialize()
-
// Do not display menu on small screens
if (this.screenService.isInSmallView()) {
this.isMenuDisplayed = false
private async openModalsIfNeeded () {
this.serverService.configLoaded
.pipe(
+ first(),
switchMap(() => this.authService.userInformationLoaded),
map(() => this.authService.getUser()),
filter(user => user.role === UserRole.ADMINISTRATOR)
if (user.noWelcomeModal !== true) return this.welcomeModal.show()
const config = this.serverService.getConfig()
-
- if (user.noInstanceConfigWarningModal !== true && config.signup.allowed && config.instance.name.toLowerCase() === 'peertube') {
- this.instanceService.getAbout()
- .subscribe(about => {
- if (!about.instance.terms) {
- this.instanceConfigWarningModal.show()
- }
- })
- }
+ 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)
+ }
+ })
}
private initHotkeys () {