aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/modal/account-setup-modal.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/modal/account-setup-modal.component.ts')
-rw-r--r--client/src/app/modal/account-setup-modal.component.ts73
1 files changed, 0 insertions, 73 deletions
diff --git a/client/src/app/modal/account-setup-modal.component.ts b/client/src/app/modal/account-setup-modal.component.ts
deleted file mode 100644
index 4cb8de2c7..000000000
--- a/client/src/app/modal/account-setup-modal.component.ts
+++ /dev/null
@@ -1,73 +0,0 @@
1import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'
2import { AuthService, ServerService, User, UserService } from '@app/core'
3import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'
4import { HTMLServerConfig } from '@shared/models'
5
6@Component({
7 selector: 'my-account-setup-modal',
8 templateUrl: './account-setup-modal.component.html',
9 styleUrls: [ './account-setup-modal.component.scss' ]
10})
11export class AccountSetupModalComponent implements OnInit {
12 @ViewChild('modal', { static: true }) modal: ElementRef
13
14 user: User = null
15 ref: NgbModalRef = null
16
17 private serverConfig: HTMLServerConfig
18
19 constructor (
20 private userService: UserService,
21 private authService: AuthService,
22 private modalService: NgbModal,
23 private serverService: ServerService
24 ) { }
25
26 get userInformationLoaded () {
27 return this.authService.userInformationLoaded
28 }
29
30 get instanceName () {
31 return this.serverConfig.instance.name
32 }
33
34 get isUserRoot () {
35 return this.user.username === 'root'
36 }
37
38 get hasAccountAvatar () {
39 return !!this.user.account.avatar
40 }
41
42 get hasAccountDescription () {
43 return !!this.user.account.description
44 }
45
46 ngOnInit () {
47 this.serverConfig = this.serverService.getHTMLConfig()
48
49 this.authService.userInformationLoaded
50 .subscribe(
51 () => {
52 this.user = this.authService.getUser()
53
54 if (this.isUserRoot) return
55 if (this.hasAccountAvatar && this.hasAccountDescription) return
56 if (this.userService.hasSignupInThisSession()) return
57
58 this.show()
59 }
60 )
61 }
62
63 show () {
64 if (this.ref) return
65
66 this.ref = this.modalService.open(this.modal, {
67 centered: true,
68 backdrop: 'static',
69 keyboard: false,
70 size: 'md'
71 })
72 }
73}