Skip to content

Commit b92a1b8

Browse files
authored
Do not show "Show Update Release Notes" for recovery releases (microsoft#187838)
fixes microsoft#187828
1 parent 034fd05 commit b92a1b8

File tree

1 file changed

+11
-2
lines changed
  • src/vs/workbench/contrib/update/browser

1 file changed

+11
-2
lines changed

src/vs/workbench/contrib/update/browser/update.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import { Event } from 'vs/base/common/event';
3232
import { Action } from 'vs/base/common/actions';
3333

3434
export const CONTEXT_UPDATE_STATE = new RawContextKey<string>('updateState', StateType.Uninitialized);
35+
export const MAJOR_MINOR_UPDATE_AVAILABLE = new RawContextKey<boolean>('majorMinorUpdateAvailable', false);
3536
export const RELEASE_NOTES_URL = new RawContextKey<string>('releaseNotesUrl', '');
3637
export const DOWNLOAD_URL = new RawContextKey<string>('downloadUrl', '');
3738

@@ -160,6 +161,7 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
160161
private state: UpdateState;
161162
private readonly badgeDisposable = this._register(new MutableDisposable());
162163
private updateStateContextKey: IContextKey<string>;
164+
private majorMinorUpdateAvailableContextKey: IContextKey<boolean>;
163165

164166
constructor(
165167
@IStorageService private readonly storageService: IStorageService,
@@ -176,6 +178,7 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
176178
super();
177179
this.state = updateService.state;
178180
this.updateStateContextKey = CONTEXT_UPDATE_STATE.bindTo(this.contextKeyService);
181+
this.majorMinorUpdateAvailableContextKey = MAJOR_MINOR_UPDATE_AVAILABLE.bindTo(this.contextKeyService);
179182

180183
this._register(updateService.onStateChange(this.onUpdateStateChange, this));
181184
this.onUpdateStateChange(this.updateService.state);
@@ -237,9 +240,13 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
237240
this.onUpdateDownloaded(state.update);
238241
break;
239242

240-
case StateType.Ready:
243+
case StateType.Ready: {
244+
const currentVersion = parseVersion(this.productService.version);
245+
const nextVersion = parseVersion(state.update.productVersion);
246+
this.majorMinorUpdateAvailableContextKey.set(Boolean(currentVersion && nextVersion && isMajorMinorUpdate(currentVersion, nextVersion)));
241247
this.onUpdateReady(state.update);
242248
break;
249+
}
243250
}
244251

245252
let badge: IBadge | undefined = undefined;
@@ -461,16 +468,18 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
461468
});
462469
MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
463470
group: '7_update',
471+
order: 1,
464472
command: {
465473
id: 'update.showUpdateReleaseNotes',
466474
title: nls.localize('showUpdateReleaseNotes', "Show Update Release Notes")
467475
},
468-
when: CONTEXT_UPDATE_STATE.isEqualTo(StateType.Ready)
476+
when: ContextKeyExpr.and(CONTEXT_UPDATE_STATE.isEqualTo(StateType.Ready), MAJOR_MINOR_UPDATE_AVAILABLE)
469477
});
470478

471479
CommandsRegistry.registerCommand('update.restart', () => this.updateService.quitAndInstall());
472480
MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
473481
group: '7_update',
482+
order: 2,
474483
command: {
475484
id: 'update.restart',
476485
title: nls.localize('restartToUpdate', "Restart to Update (1)")

0 commit comments

Comments
 (0)