diff options
Diffstat (limited to 'client/src/app/menu')
-rw-r--r-- | client/src/app/menu/menu.component.ts | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/client/src/app/menu/menu.component.ts b/client/src/app/menu/menu.component.ts index c7c31577a..2d522b521 100644 --- a/client/src/app/menu/menu.component.ts +++ b/client/src/app/menu/menu.component.ts | |||
@@ -4,6 +4,7 @@ import { AuthService, AuthStatus, RedirectService, ServerService, ThemeService } | |||
4 | import { User } from '../shared/users/user.model' | 4 | import { User } from '../shared/users/user.model' |
5 | import { LanguageChooserComponent } from '@app/menu/language-chooser.component' | 5 | import { LanguageChooserComponent } from '@app/menu/language-chooser.component' |
6 | import { HotkeysService } from 'angular2-hotkeys' | 6 | import { HotkeysService } from 'angular2-hotkeys' |
7 | import { ServerConfig } from '@shared/models' | ||
7 | 8 | ||
8 | @Component({ | 9 | @Component({ |
9 | selector: 'my-menu', | 10 | selector: 'my-menu', |
@@ -18,6 +19,7 @@ export class MenuComponent implements OnInit { | |||
18 | userHasAdminAccess = false | 19 | userHasAdminAccess = false |
19 | helpVisible = false | 20 | helpVisible = false |
20 | 21 | ||
22 | private serverConfig: ServerConfig | ||
21 | private routesPerRight: { [ role in UserRight ]?: string } = { | 23 | private routesPerRight: { [ role in UserRight ]?: string } = { |
22 | [UserRight.MANAGE_USERS]: '/admin/users', | 24 | [UserRight.MANAGE_USERS]: '/admin/users', |
23 | [UserRight.MANAGE_SERVER_FOLLOW]: '/admin/friends', | 25 | [UserRight.MANAGE_SERVER_FOLLOW]: '/admin/friends', |
@@ -36,6 +38,10 @@ export class MenuComponent implements OnInit { | |||
36 | ) {} | 38 | ) {} |
37 | 39 | ||
38 | ngOnInit () { | 40 | ngOnInit () { |
41 | this.serverConfig = this.serverService.getTmpConfig() | ||
42 | this.serverService.getConfig() | ||
43 | .subscribe(config => this.serverConfig = config) | ||
44 | |||
39 | this.isLoggedIn = this.authService.isLoggedIn() | 45 | this.isLoggedIn = this.authService.isLoggedIn() |
40 | if (this.isLoggedIn === true) this.user = this.authService.getUser() | 46 | if (this.isLoggedIn === true) this.user = this.authService.getUser() |
41 | this.computeIsUserHasAdminAccess() | 47 | this.computeIsUserHasAdminAccess() |
@@ -64,8 +70,8 @@ export class MenuComponent implements OnInit { | |||
64 | } | 70 | } |
65 | 71 | ||
66 | isRegistrationAllowed () { | 72 | isRegistrationAllowed () { |
67 | return this.serverService.getConfig().signup.allowed && | 73 | return this.serverConfig.signup.allowed && |
68 | this.serverService.getConfig().signup.allowedForCurrentIP | 74 | this.serverConfig.signup.allowedForCurrentIP |
69 | } | 75 | } |
70 | 76 | ||
71 | getFirstAdminRightAvailable () { | 77 | getFirstAdminRightAvailable () { |