X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fmodal%2Finstance-config-warning-modal.component.ts;h=300738a41f79321cd143fb74555bb7ba50fbcfad;hb=80badf493afca026bc542260f353210e605a1715;hp=e4095897661805db231947fb66e4ffcdfe7a6f72;hpb=1378c0d343028f3d40d7d795422684ab9e6a1599;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/modal/instance-config-warning-modal.component.ts b/client/src/app/modal/instance-config-warning-modal.component.ts index e40958976..300738a41 100644 --- a/client/src/app/modal/instance-config-warning-modal.component.ts +++ b/client/src/app/modal/instance-config-warning-modal.component.ts @@ -1,9 +1,9 @@ import { Location } from '@angular/common' import { Component, ElementRef, ViewChild } from '@angular/core' -import { Notifier, UserService } from '@app/core' +import { Notifier, User, UserService } from '@app/core' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' -import { About } from '@shared/models/server' +import { About, ServerConfig } from '@shared/models/server' @Component({ selector: 'my-instance-config-warning-modal', @@ -27,10 +27,23 @@ export class InstanceConfigWarningModalComponent { private notifier: Notifier ) { } - show (about: About) { - const result = peertubeLocalStorage.getItem(this.LOCAL_STORAGE_KEYS.NO_INSTANCE_CONFIG_WARNING_MODAL) - if (result === 'true') return + shouldOpenByUser (user: User) { + if (user.noInstanceConfigWarningModal === true) return false + if (peertubeLocalStorage.getItem(this.LOCAL_STORAGE_KEYS.NO_INSTANCE_CONFIG_WARNING_MODAL) === 'true') return false + + return true + } + + shouldOpen (serverConfig: ServerConfig, about: About) { + if (!serverConfig.signup.allowed) return false + return serverConfig.instance.name.toLowerCase() === 'peertube' || + !about.instance.terms || + !about.instance.administrator || + !about.instance.maintenanceLifetime + } + + show (about: About) { if (this.location.path().startsWith('/admin/config/edit-custom')) return this.about = about