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/welcome-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/welcome-modal.component.ts')
-rw-r--r-- | client/src/app/modal/welcome-modal.component.ts | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/client/src/app/modal/welcome-modal.component.ts b/client/src/app/modal/welcome-modal.component.ts deleted file mode 100644 index 06fe4cba5..000000000 --- a/client/src/app/modal/welcome-modal.component.ts +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | import { Component, ElementRef, ViewChild } from '@angular/core' | ||
2 | import { Notifier, UserService } from '@app/core' | ||
3 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | ||
4 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' | ||
5 | |||
6 | @Component({ | ||
7 | selector: 'my-welcome-modal', | ||
8 | templateUrl: './welcome-modal.component.html', | ||
9 | styleUrls: [ './welcome-modal.component.scss' ] | ||
10 | }) | ||
11 | export class WelcomeModalComponent { | ||
12 | @ViewChild('modal', { static: true }) modal: ElementRef | ||
13 | |||
14 | private LOCAL_STORAGE_KEYS = { | ||
15 | NO_WELCOME_MODAL: 'no_welcome_modal' | ||
16 | } | ||
17 | |||
18 | constructor ( | ||
19 | private userService: UserService, | ||
20 | private modalService: NgbModal, | ||
21 | private notifier: Notifier | ||
22 | ) { } | ||
23 | |||
24 | show () { | ||
25 | const result = peertubeLocalStorage.getItem(this.LOCAL_STORAGE_KEYS.NO_WELCOME_MODAL) | ||
26 | if (result === 'true') return | ||
27 | |||
28 | this.modalService.open(this.modal, { | ||
29 | centered: true, | ||
30 | backdrop: 'static', | ||
31 | keyboard: false, | ||
32 | size: 'lg' | ||
33 | }) | ||
34 | } | ||
35 | |||
36 | doNotOpenAgain () { | ||
37 | peertubeLocalStorage.setItem(this.LOCAL_STORAGE_KEYS.NO_WELCOME_MODAL, 'true') | ||
38 | |||
39 | this.userService.updateMyProfile({ noWelcomeModal: true }) | ||
40 | .subscribe({ | ||
41 | next: () => console.log('We will not open the welcome modal again.'), | ||
42 | |||
43 | error: err => this.notifier.error(err.message) | ||
44 | }) | ||
45 | } | ||
46 | } | ||