aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/menu/menu.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/menu/menu.component.ts')
-rw-r--r--client/src/app/menu/menu.component.ts65
1 files changed, 34 insertions, 31 deletions
diff --git a/client/src/app/menu/menu.component.ts b/client/src/app/menu/menu.component.ts
index 97a3b6d24..bdc95127b 100644
--- a/client/src/app/menu/menu.component.ts
+++ b/client/src/app/menu/menu.component.ts
@@ -28,6 +28,11 @@ export class MenuComponent implements OnInit {
28 helpVisible = false 28 helpVisible = false
29 29
30 videoLanguages: string[] = [] 30 videoLanguages: string[] = []
31 nsfwPolicy: string
32
33 loggedInMorePlacement: string
34
35 currentInterfaceLanguage: string
31 36
32 private languages: VideoConstant<string>[] = [] 37 private languages: VideoConstant<string>[] = []
33 private serverConfig: ServerConfig 38 private serverConfig: ServerConfig
@@ -52,37 +57,6 @@ export class MenuComponent implements OnInit {
52 private router: Router 57 private router: Router
53 ) { } 58 ) { }
54 59
55 get isInMobileView () {
56 return this.screenService.isInMobileView()
57 }
58
59 get placement () {
60 if (this.isInMobileView) {
61 return 'left-top auto'
62 } else {
63 return 'right-top auto'
64 }
65 }
66
67 get language () {
68 return this.languageChooserModal.getCurrentLanguage()
69 }
70
71 get nsfwPolicy () {
72 if (!this.user) return
73
74 switch (this.user.nsfwPolicy) {
75 case 'do_not_list':
76 return $localize`hide`
77
78 case 'blur':
79 return $localize`blur`
80
81 case 'display':
82 return $localize`display`
83 }
84 }
85
86 get instanceName () { 60 get instanceName () {
87 return this.serverConfig.instance.name 61 return this.serverConfig.instance.name
88 } 62 }
@@ -95,11 +69,19 @@ export class MenuComponent implements OnInit {
95 this.isLoggedIn = this.authService.isLoggedIn() 69 this.isLoggedIn = this.authService.isLoggedIn()
96 if (this.isLoggedIn === true) { 70 if (this.isLoggedIn === true) {
97 this.user = this.authService.getUser() 71 this.user = this.authService.getUser()
72
73 this.computeNSFWPolicy()
98 this.computeVideosLink() 74 this.computeVideosLink()
99 } 75 }
100 76
101 this.computeAdminAccess() 77 this.computeAdminAccess()
102 78
79 this.loggedInMorePlacement = this.screenService.isInMobileView()
80 ? 'left-top auto'
81 : 'right-top auto'
82
83 this.currentInterfaceLanguage = this.languageChooserModal.getCurrentLanguage()
84
103 this.authService.loginChangedSource.subscribe( 85 this.authService.loginChangedSource.subscribe(
104 status => { 86 status => {
105 if (status === AuthStatus.LoggedIn) { 87 if (status === AuthStatus.LoggedIn) {
@@ -252,4 +234,25 @@ export class MenuComponent implements OnInit {
252 else logger('User cannot see videos link.') 234 else logger('User cannot see videos link.')
253 }) 235 })
254 } 236 }
237
238 private computeNSFWPolicy () {
239 if (!this.user) {
240 this.nsfwPolicy = null
241 return
242 }
243
244 switch (this.user.nsfwPolicy) {
245 case 'do_not_list':
246 this.nsfwPolicy = $localize`hide`
247 break
248
249 case 'blur':
250 this.nsfwPolicy = $localize`blur`
251 break
252
253 case 'display':
254 this.nsfwPolicy = $localize`display`
255 break
256 }
257 }
255} 258}