diff options
author | Chocobozzz <me@florianbigard.com> | 2021-08-27 10:15:55 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-08-27 10:15:55 +0200 |
commit | 8f581725651c4b2c213d75fc028e306bbf239d3e (patch) | |
tree | 8deb842327c2a227d8e302d9a84bd9f8f9f7affa /client/src/app/modal/instance-config-warning-modal.component.ts | |
parent | 1ff15061b31245df4248e47228d0a90b07ab3f01 (diff) | |
download | PeerTube-8f581725651c4b2c213d75fc028e306bbf239d3e.tar.gz PeerTube-8f581725651c4b2c213d75fc028e306bbf239d3e.tar.zst PeerTube-8f581725651c4b2c213d75fc028e306bbf239d3e.zip |
Allow accounts to skip account setup modal
Diffstat (limited to 'client/src/app/modal/instance-config-warning-modal.component.ts')
-rw-r--r-- | client/src/app/modal/instance-config-warning-modal.component.ts | 23 |
1 files changed, 18 insertions, 5 deletions
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 @@ | |||
1 | import { Location } from '@angular/common' | 1 | import { Location } from '@angular/common' |
2 | import { Component, ElementRef, ViewChild } from '@angular/core' | 2 | import { Component, ElementRef, ViewChild } from '@angular/core' |
3 | import { Notifier, UserService } from '@app/core' | 3 | import { Notifier, User, UserService } from '@app/core' |
4 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 4 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
5 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' | 5 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' |
6 | import { About } from '@shared/models/server' | 6 | import { About, ServerConfig } from '@shared/models/server' |
7 | 7 | ||
8 | @Component({ | 8 | @Component({ |
9 | selector: 'my-instance-config-warning-modal', | 9 | selector: 'my-instance-config-warning-modal', |
@@ -27,10 +27,23 @@ export class InstanceConfigWarningModalComponent { | |||
27 | private notifier: Notifier | 27 | private notifier: Notifier |
28 | ) { } | 28 | ) { } |
29 | 29 | ||
30 | show (about: About) { | 30 | shouldOpenByUser (user: User) { |
31 | const result = peertubeLocalStorage.getItem(this.LOCAL_STORAGE_KEYS.NO_INSTANCE_CONFIG_WARNING_MODAL) | 31 | if (user.noInstanceConfigWarningModal === true) return false |
32 | if (result === 'true') return | 32 | if (peertubeLocalStorage.getItem(this.LOCAL_STORAGE_KEYS.NO_INSTANCE_CONFIG_WARNING_MODAL) === 'true') return false |
33 | |||
34 | return true | ||
35 | } | ||
36 | |||
37 | shouldOpen (serverConfig: ServerConfig, about: About) { | ||
38 | if (!serverConfig.signup.allowed) return false | ||
33 | 39 | ||
40 | return serverConfig.instance.name.toLowerCase() === 'peertube' || | ||
41 | !about.instance.terms || | ||
42 | !about.instance.administrator || | ||
43 | !about.instance.maintenanceLifetime | ||
44 | } | ||
45 | |||
46 | show (about: About) { | ||
34 | if (this.location.path().startsWith('/admin/config/edit-custom')) return | 47 | if (this.location.path().startsWith('/admin/config/edit-custom')) return |
35 | 48 | ||
36 | this.about = about | 49 | this.about = about |