Skip to content

Commit 042e505

Browse files
authored
Allow deleting all edit sessions when signing out (microsoft#154579)
1 parent b0213f8 commit 042e505

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/vs/workbench/contrib/editSessions/browser/editSessionsWorkbenchService.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { UserDataSyncStoreClient } from 'vs/platform/userDataSync/common/userDat
1919
import { AuthenticationSession, AuthenticationSessionsChangeEvent, IAuthenticationService } from 'vs/workbench/services/authentication/common/authentication';
2020
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
2121
import { EDIT_SESSIONS_SIGNED_IN, EditSession, EDIT_SESSION_SYNC_CATEGORY, IEditSessionsWorkbenchService, EDIT_SESSIONS_SIGNED_IN_KEY, IEditSessionsLogService } from 'vs/workbench/contrib/editSessions/common/editSessions';
22+
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
2223
import { generateUuid } from 'vs/base/common/uuid';
2324

2425
type ExistingSession = IQuickPickItem & { session: AuthenticationSession & { providerId: string } };
@@ -48,6 +49,7 @@ export class EditSessionsWorkbenchService extends Disposable implements IEditSes
4849
@IProductService private readonly productService: IProductService,
4950
@IContextKeyService private readonly contextKeyService: IContextKeyService,
5051
@IRequestService private readonly requestService: IRequestService,
52+
@IDialogService private readonly dialogService: IDialogService,
5153
) {
5254
super();
5355

@@ -352,8 +354,19 @@ export class EditSessionsWorkbenchService extends Disposable implements IEditSes
352354
});
353355
}
354356

355-
run() {
356-
that.clearAuthenticationPreference();
357+
async run() {
358+
const result = await that.dialogService.confirm({
359+
type: 'info',
360+
message: localize('sign out of edit sessions clear data prompt', 'Do you want to sign out of edit sessions?'),
361+
checkbox: { label: localize('delete all edit sessions', 'Delete all stored edit sessions from the cloud.') },
362+
primaryButton: localize('clear data confirm', 'Yes'),
363+
});
364+
if (result.confirmed) {
365+
if (result.checkboxChecked) {
366+
that.storeClient?.delete('editSessions', null);
367+
}
368+
that.clearAuthenticationPreference();
369+
}
357370
}
358371
}));
359372
}

0 commit comments

Comments
 (0)