diff options
author | Chocobozzz <me@florianbigard.com> | 2021-04-20 15:11:00 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-04-20 15:18:37 +0200 |
commit | 9929fbd6f4e209346cd31d05888417a94949da84 (patch) | |
tree | 762006f2e0eb2d0cb094dc97b407ae5ea35689a1 /client/src/app/modal/instance-config-warning-modal.component.ts | |
parent | 4024c44f9027a32809931de0692d40d001df721c (diff) | |
download | PeerTube-9929fbd6f4e209346cd31d05888417a94949da84.tar.gz PeerTube-9929fbd6f4e209346cd31d05888417a94949da84.tar.zst PeerTube-9929fbd6f4e209346cd31d05888417a94949da84.zip |
Fix welcome/warning 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 | 14 |
1 files changed, 14 insertions, 0 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 c42413fc0..8bf7672be 100644 --- a/client/src/app/modal/instance-config-warning-modal.component.ts +++ b/client/src/app/modal/instance-config-warning-modal.component.ts | |||
@@ -1,6 +1,8 @@ | |||
1 | import { Location } from '@angular/common' | ||
1 | import { Component, ElementRef, ViewChild } from '@angular/core' | 2 | import { Component, ElementRef, ViewChild } from '@angular/core' |
2 | import { Notifier, UserService } from '@app/core' | 3 | import { Notifier, UserService } from '@app/core' |
3 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 4 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
5 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' | ||
4 | import { About } from '@shared/models/server' | 6 | import { About } from '@shared/models/server' |
5 | 7 | ||
6 | @Component({ | 8 | @Component({ |
@@ -14,13 +16,23 @@ export class InstanceConfigWarningModalComponent { | |||
14 | stopDisplayModal = false | 16 | stopDisplayModal = false |
15 | about: About | 17 | about: About |
16 | 18 | ||
19 | private LOCAL_STORAGE_KEYS = { | ||
20 | NO_INSTANCE_CONFIG_WARNING_MODAL: 'no_instance_config_warning_modal' | ||
21 | } | ||
22 | |||
17 | constructor ( | 23 | constructor ( |
18 | private userService: UserService, | 24 | private userService: UserService, |
25 | private location: Location, | ||
19 | private modalService: NgbModal, | 26 | private modalService: NgbModal, |
20 | private notifier: Notifier | 27 | private notifier: Notifier |
21 | ) { } | 28 | ) { } |
22 | 29 | ||
23 | show (about: About) { | 30 | show (about: About) { |
31 | const result = peertubeLocalStorage.getItem(this.LOCAL_STORAGE_KEYS.NO_INSTANCE_CONFIG_WARNING_MODAL) | ||
32 | if (result === 'true') return | ||
33 | |||
34 | if (this.location.path().startsWith('/admin/config/edit-custom')) return | ||
35 | |||
24 | this.about = about | 36 | this.about = about |
25 | 37 | ||
26 | const ref = this.modalService.open(this.modal, { centered: true }) | 38 | const ref = this.modalService.open(this.modal, { centered: true }) |
@@ -35,6 +47,8 @@ export class InstanceConfigWarningModalComponent { | |||
35 | } | 47 | } |
36 | 48 | ||
37 | private doNotOpenAgain () { | 49 | private doNotOpenAgain () { |
50 | peertubeLocalStorage.setItem(this.LOCAL_STORAGE_KEYS.NO_INSTANCE_CONFIG_WARNING_MODAL, 'true') | ||
51 | |||
38 | this.userService.updateMyProfile({ noInstanceConfigWarningModal: true }) | 52 | this.userService.updateMyProfile({ noInstanceConfigWarningModal: true }) |
39 | .subscribe( | 53 | .subscribe( |
40 | () => console.log('We will not open the instance config warning modal again.'), | 54 | () => console.log('We will not open the instance config warning modal again.'), |