|
4 | 4 | * Licensed under the MIT License. See License.txt in the project root for license information.
|
5 | 5 | *--------------------------------------------------------------------------------------------*/
|
6 | 6 |
|
| 7 | +import { AuthType } from 'vs/base/common/auth'; |
7 | 8 | import { Disposable } from 'vs/base/common/lifecycle';
|
8 | 9 | import { localize } from 'vs/nls';
|
9 | 10 | import { MenuId, MenuRegistry } from 'vs/platform/actions/common/actions';
|
@@ -174,34 +175,26 @@ export class CodeServerClientAdditions extends Disposable {
|
174 | 175 | }
|
175 | 176 |
|
176 | 177 | private appendSessionCommands() {
|
177 |
| - const { authed, logoutEndpointUrl } = this.productConfiguration; |
| 178 | + const { auth, logoutEndpointUrl } = this.productConfiguration; |
178 | 179 |
|
179 | 180 | // Use to show or hide logout commands and menu options.
|
180 |
| - this.contextKeyService.createKey(CodeServerClientAdditions.AUTH_KEY, !!authed); |
| 181 | + this.contextKeyService.createKey(CodeServerClientAdditions.AUTH_KEY, auth === AuthType.Password); |
181 | 182 |
|
182 | 183 | CommandsRegistry.registerCommand(CodeServerClientAdditions.LOGOUT_COMMAND_ID, () => {
|
183 | 184 | if (logoutEndpointUrl) {
|
184 | 185 | window.location.href = logoutEndpointUrl;
|
185 | 186 | }
|
186 | 187 | });
|
187 | 188 |
|
188 |
| - // Add logout to command palette. |
189 |
| - MenuRegistry.appendMenuItem(MenuId.CommandPalette, { |
190 |
| - command: { |
191 |
| - id: CodeServerClientAdditions.LOGOUT_COMMAND_ID, |
192 |
| - title: localize('logout', 'Log out'), |
193 |
| - }, |
194 |
| - when: ContextKeyExpr.has(CodeServerClientAdditions.AUTH_KEY), |
195 |
| - }); |
196 |
| - |
197 |
| - // Add logout to the (web-only) home menu. |
198 |
| - MenuRegistry.appendMenuItem(MenuId.MenubarHomeMenu, { |
199 |
| - command: { |
200 |
| - id: CodeServerClientAdditions.LOGOUT_COMMAND_ID, |
201 |
| - title: localize('logout', 'Log out'), |
202 |
| - }, |
203 |
| - when: ContextKeyExpr.has(CodeServerClientAdditions.AUTH_KEY), |
204 |
| - }); |
| 189 | + for (const menuId of [MenuId.CommandPalette, MenuId.MenubarHomeMenu]) { |
| 190 | + MenuRegistry.appendMenuItem(menuId, { |
| 191 | + command: { |
| 192 | + id: CodeServerClientAdditions.LOGOUT_COMMAND_ID, |
| 193 | + title: localize('logout', 'Sign out of {0}', this.productConfiguration.nameShort), |
| 194 | + }, |
| 195 | + when: ContextKeyExpr.has(CodeServerClientAdditions.AUTH_KEY), |
| 196 | + }); |
| 197 | + } |
205 | 198 | }
|
206 | 199 |
|
207 | 200 | private registerServiceWorker = async (): Promise<void> => {
|
|
0 commit comments