diff --git a/src/vs/platform/userDataSync/common/userDataAutoSyncService.ts b/src/vs/platform/userDataSync/common/userDataAutoSyncService.ts index 62dd7cc144c41..cb5c8d665f718 100644 --- a/src/vs/platform/userDataSync/common/userDataAutoSyncService.ts +++ b/src/vs/platform/userDataSync/common/userDataAutoSyncService.ts @@ -219,8 +219,14 @@ export class UserDataAutoSyncService extends UserDataAutoSyncEnablementService i this.telemetryService.publicLog2<{ code: string }, AutoSyncErrorClassification>(`autosync/error`, { code: userDataSyncError.code }); } - // Turned off from another device or session got expired - if (userDataSyncError.code === UserDataSyncErrorCode.TurnedOff || userDataSyncError.code === UserDataSyncErrorCode.SessionExpired) { + // Session got expired + if (userDataSyncError.code === UserDataSyncErrorCode.SessionExpired) { + await this.turnOff(false, true /* force soft turnoff on error */); + this.logService.info('Auto Sync: Turned off sync because current session is expired'); + } + + // Turned off from another device + if (userDataSyncError.code === UserDataSyncErrorCode.TurnedOff) { await this.turnOff(false, true /* force soft turnoff on error */); this.logService.info('Auto Sync: Turned off sync because sync is turned off in the cloud'); } diff --git a/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts b/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts index a7db7c25c79f3..436487eab2fee 100644 --- a/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts +++ b/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts @@ -270,11 +270,19 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo private onAutoSyncError(error: UserDataSyncError): void { switch (error.code) { - case UserDataSyncErrorCode.TurnedOff: case UserDataSyncErrorCode.SessionExpired: this.notificationService.notify({ severity: Severity.Info, - message: localize('turned off', "Preferences sync was turned off from another device."), + message: localize('session expired', "Preferences sync was turned off because current session is expired, please sign in again to turn on sync."), + actions: { + primary: [new Action('turn on sync', localize('turn on sync', "Turn on Preferences Sync..."), undefined, true, () => this.turnOn())] + } + }); + break; + case UserDataSyncErrorCode.TurnedOff: + this.notificationService.notify({ + severity: Severity.Info, + message: localize('turned off', "Preferences sync was turned off from another device, please sign in again to turn on sync."), actions: { primary: [new Action('turn on sync', localize('turn on sync', "Turn on Preferences Sync..."), undefined, true, () => this.turnOn())] }