Free SKU flow does not work with multiple accounts (fix microsoft/vscode-copilot#11323) (#236190)

This commit is contained in:
Benjamin Pasero
2024-12-16 10:18:00 +01:00
committed by GitHub
parent 7432213b30
commit 737e2ed44a
@@ -42,7 +42,7 @@ import { IWorkspaceContextService } from '../../../../platform/workspace/common/
import { IWorkbenchContribution } from '../../../common/contributions.js';
import { IViewDescriptorService, ViewContainerLocation } from '../../../common/views.js';
import { IActivityService, ProgressBadge } from '../../../services/activity/common/activity.js';
import { AuthenticationSession, IAuthenticationService } from '../../../services/authentication/common/authentication.js';
import { AuthenticationSession, IAuthenticationExtensionsService, IAuthenticationService } from '../../../services/authentication/common/authentication.js';
import { IWorkbenchExtensionEnablementService } from '../../../services/extensionManagement/common/extensionManagement.js';
import { IExtensionService } from '../../../services/extensions/common/extensions.js';
import { IWorkbenchLayoutService, Parts } from '../../../services/layout/browser/layoutService.js';
@@ -706,6 +706,7 @@ class ChatSetupController extends Disposable {
private readonly requests: ChatSetupRequests,
@ITelemetryService private readonly telemetryService: ITelemetryService,
@IAuthenticationService private readonly authenticationService: IAuthenticationService,
@IAuthenticationExtensionsService private readonly authenticationExtensionsService: IAuthenticationExtensionsService,
@IViewsService private readonly viewsService: IViewsService,
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
@IProductService private readonly productService: IProductService,
@@ -804,8 +805,11 @@ class ChatSetupController extends Disposable {
session = await this.authenticationService.createSession(defaultChat.providerId, defaultChat.providerScopes[0]);
entitlement = await this.requests.forceResolveEntitlement(session);
this.authenticationExtensionsService.updateAccountPreference(defaultChat.extensionId, defaultChat.providerId, session.account);
this.authenticationExtensionsService.updateAccountPreference(defaultChat.chatExtensionId, defaultChat.providerId, session.account);
} catch (error) {
// noop
this.logService.error(`[chat setup] signIn: error ${error}`);
}
if (!session) {