Skip to content

Commit

Permalink
Remove code for disabled chat welcome view exp (#222000)
Browse files Browse the repository at this point in the history
* Remove code for disabled chat welcome view exp

* Update distro
  • Loading branch information
bhavyaus committed Jul 18, 2024
1 parent 97ac031 commit 6656043
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 80 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "code-oss-dev",
"version": "1.92.0",
"distro": "e697db8a89b3ba772d4260e508cc6211fe1f158c",
"distro": "fadcd761fdc7e186428885eb1bd409300b33a5bc",
"author": {
"name": "Microsoft Corporation"
},
Expand Down
7 changes: 0 additions & 7 deletions src/vs/base/common/product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ export interface IProductConfiguration {
readonly commonlyUsedSettings?: string[];
readonly aiGeneratedWorkspaceTrust?: IAiGeneratedWorkspaceTrust;
readonly gitHubEntitlement?: IGitHubEntitlement;
readonly chatWelcomeView?: IChatWelcomeView;
readonly chatParticipantRegistry?: string;
}

Expand Down Expand Up @@ -307,9 +306,3 @@ export interface IGitHubEntitlement {
confirmationMessage: string;
confirmationAction: string;
}

export interface IChatWelcomeView {
welcomeViewId: string;
welcomeViewTitle: string;
welcomeViewContent: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ import { IRequestService, asText } from 'vs/platform/request/common/request';
import { CancellationToken } from 'vs/base/common/cancellation';
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { isWeb } from 'vs/base/common/platform';
import { isInternalTelemetry } from 'vs/platform/telemetry/common/telemetryUtils';

const accountsBadgeConfigKey = 'workbench.accounts.experimental.showEntitlements';
const chatWelcomeViewConfigKey = 'workbench.chat.experimental.showWelcomeView';

type EntitlementEnablementClassification = {
enabled: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Flag indicating if the entitlement is enabled' };
Expand All @@ -47,7 +45,6 @@ class EntitlementsContribution extends Disposable implements IWorkbenchContribut

private isInitialized = false;
private showAccountsBadgeContextKey = new RawContextKey<boolean>(accountsBadgeConfigKey, false).bindTo(this.contextService);
private showChatWelcomeViewContextKey = new RawContextKey<boolean>(chatWelcomeViewConfigKey, false).bindTo(this.contextService);
private readonly accountsMenuBadgeDisposable = this._register(new MutableDisposable());

constructor(
Expand Down Expand Up @@ -98,7 +95,6 @@ class EntitlementsContribution extends Disposable implements IWorkbenchContribut
await this.enableEntitlements(e.event.added[0]);
} else if (e.providerId === this.productService.gitHubEntitlement!.providerId && e.event.removed?.length) {
this.showAccountsBadgeContextKey.set(false);
this.showChatWelcomeViewContextKey.set(false);
this.accountsMenuBadgeDisposable.clear();
}
}));
Expand Down Expand Up @@ -156,29 +152,19 @@ class EntitlementsContribution extends Disposable implements IWorkbenchContribut
return;
}

const isInternal = isInternalTelemetry(this.productService, this.configurationService);
const showAccountsBadge = this.configurationService.inspect<boolean>(accountsBadgeConfigKey).value ?? false;
const showWelcomeView = this.configurationService.inspect<boolean>(chatWelcomeViewConfigKey).value ?? false;

const [enabled, org] = await this.getEntitlementsInfo(session);
if (enabled) {
if (isInternal && showWelcomeView) {
this.showChatWelcomeViewContextKey.set(true);
this.telemetryService.publicLog2<{ enabled: boolean }, EntitlementEnablementClassification>(chatWelcomeViewConfigKey, { enabled: true });
}
if (showAccountsBadge) {
this.createAccountsBadge(org);
this.showAccountsBadgeContextKey.set(showAccountsBadge);
this.telemetryService.publicLog2<{ enabled: boolean }, EntitlementEnablementClassification>(accountsBadgeConfigKey, { enabled: true });
}
if (enabled && showAccountsBadge) {
this.createAccountsBadge(org);
this.showAccountsBadgeContextKey.set(showAccountsBadge);
this.telemetryService.publicLog2<{ enabled: boolean }, EntitlementEnablementClassification>(accountsBadgeConfigKey, { enabled: true });
}
}

private disableEntitlements() {
this.storageService.store(accountsBadgeConfigKey, false, StorageScope.APPLICATION, StorageTarget.MACHINE);
this.storageService.store(chatWelcomeViewConfigKey, false, StorageScope.APPLICATION, StorageTarget.MACHINE);
this.showAccountsBadgeContextKey.set(false);
this.showChatWelcomeViewContextKey.set(false);
this.accountsMenuBadgeDisposable.clear();
}

Expand Down Expand Up @@ -260,17 +246,4 @@ configurationRegistry.registerConfiguration({
}
});

configurationRegistry.registerConfiguration({
...applicationConfigurationNodeBase,
properties: {
'workbench.chat.experimental.showWelcomeView': {
scope: ConfigurationScope.MACHINE,
type: 'boolean',
default: false,
tags: ['experimental'],
description: localize('workbench.chat.showWelcomeView', "When enabled, the chat panel welcome view will be shown.")
}
}
});

registerWorkbenchContribution2('workbench.contrib.entitlements', EntitlementsContribution, WorkbenchPhase.BlockRestore);
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ import * as strings from 'vs/base/common/strings';
import { Codicon } from 'vs/base/common/codicons';
import { Disposable, DisposableMap, DisposableStore, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
import { localize, localize2 } from 'vs/nls';
import { ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { ILogService } from 'vs/platform/log/common/log';
import { IProductService } from 'vs/platform/product/common/productService';
import { Registry } from 'vs/platform/registry/common/platform';
import { ViewPaneContainer } from 'vs/workbench/browser/parts/views/viewPaneContainer';
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
Expand Down Expand Up @@ -113,58 +111,19 @@ export class ChatExtensionPointHandler implements IWorkbenchContribution {

static readonly ID = 'workbench.contrib.chatExtensionPointHandler';

private readonly disposables = new DisposableStore();
private _welcomeViewDescriptor?: IViewDescriptor;
private _viewContainer: ViewContainer;
private _participantRegistrationDisposables = new DisposableMap<string>();

constructor(
@IChatAgentService private readonly _chatAgentService: IChatAgentService,
@IProductService private readonly productService: IProductService,
@IContextKeyService private readonly contextService: IContextKeyService,
@ILogService private readonly logService: ILogService,
@INotificationService private readonly notificationService: INotificationService,
@ICommandService private readonly commandService: ICommandService,
) {
this._viewContainer = this.registerViewContainer();
this.registerListeners();
this.handleAndRegisterChatExtensions();
}

private registerListeners() {
this.contextService.onDidChangeContext(e => {

if (!this.productService.chatWelcomeView) {
return;
}

const showWelcomeViewConfigKey = 'workbench.chat.experimental.showWelcomeView';
const keys = new Set([showWelcomeViewConfigKey]);
if (e.affectsSome(keys)) {
const contextKeyExpr = ContextKeyExpr.equals(showWelcomeViewConfigKey, true);
const viewsRegistry = Registry.as<IViewsRegistry>(ViewExtensions.ViewsRegistry);
if (this.contextService.contextMatchesRules(contextKeyExpr)) {
this._welcomeViewDescriptor = {
id: CHAT_VIEW_ID,
name: { original: this.productService.chatWelcomeView.welcomeViewTitle, value: this.productService.chatWelcomeView.welcomeViewTitle },
containerIcon: this._viewContainer.icon,
ctorDescriptor: new SyncDescriptor(ChatViewPane),
canToggleVisibility: false,
canMoveView: true,
order: 100
};
viewsRegistry.registerViews([this._welcomeViewDescriptor], this._viewContainer);

viewsRegistry.registerViewWelcomeContent(CHAT_VIEW_ID, {
content: this.productService.chatWelcomeView.welcomeViewContent,
});
} else if (this._welcomeViewDescriptor) {
viewsRegistry.deregisterViews([this._welcomeViewDescriptor], this._viewContainer);
}
}
}, null, this.disposables);
}

private handleAndRegisterChatExtensions(): void {
chatParticipantExtensionPoint.setHandler((extensions, delta) => {
for (const extension of delta.added) {
Expand Down

0 comments on commit 6656043

Please sign in to comment.