From 7c69cce7b78eaa8adc3494712abd2a3122ebf4b4 Mon Sep 17 00:00:00 2001 From: Baptiste Grob <60621355+baptiste-grob@users.noreply.github.com> Date: Mon, 28 Dec 2020 14:44:27 +0100 Subject: [PATCH] feat: use SNJS userCanManageSessions --- app/assets/javascripts/directives/views/accountMenu.ts | 8 ++++++-- app/assets/javascripts/ui_models/app_state.ts | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/directives/views/accountMenu.ts b/app/assets/javascripts/directives/views/accountMenu.ts index 3cfec1d99..e3d057847 100644 --- a/app/assets/javascripts/directives/views/accountMenu.ts +++ b/app/assets/javascripts/directives/views/accountMenu.ts @@ -102,7 +102,7 @@ class AccountMenuCtrl extends PureViewCtrl<{}, AccountMenuState> { mutable: {}, showBetaWarning: false, errorReportingEnabled: !storage.get(StorageKey.DisableErrorReporting), - showSessions: this.appState.enableUnfinishedFeatures, + showSessions: false, } as AccountMenuState; } @@ -132,8 +132,12 @@ class AccountMenuCtrl extends PureViewCtrl<{}, AccountMenuState> { }; } - $onInit() { + async $onInit() { super.$onInit(); + this.setState({ + showSessions: await this.application.userCanManageSessions() + }); + const sync = this.appState.sync; this.removeSyncObserver = autorun(() => { this.setState({ diff --git a/app/assets/javascripts/ui_models/app_state.ts b/app/assets/javascripts/ui_models/app_state.ts index 0bafd2df9..f64d2f8c8 100644 --- a/app/assets/javascripts/ui_models/app_state.ts +++ b/app/assets/javascripts/ui_models/app_state.ts @@ -110,7 +110,7 @@ export class AppState { showBetaWarning = false; readonly actionsMenu = new ActionsMenuState(); readonly sync = new SyncState(); - isSessionsModalVisible = true; + isSessionsModalVisible = false; /* @ngInject */ constructor(