From 0d586fd14e4bc1bac192c423ca43dc9f0c6325b6 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Mon, 26 Jun 2023 15:18:58 +0200 Subject: [PATCH] Add telemetry for change base on both new and old views Add for compare only on new view Part of #4403 --- src/github/createPRViewProvider.ts | 13 +++++++++++++ src/github/createPRViewProviderNew.ts | 12 ++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/github/createPRViewProvider.ts b/src/github/createPRViewProvider.ts index 4df40153b6..c3d88078c0 100644 --- a/src/github/createPRViewProvider.ts +++ b/src/github/createPRViewProvider.ts @@ -19,6 +19,7 @@ import { PUSH_BRANCH, SET_AUTO_MERGE, } from '../common/settingKeys'; +import { compareIgnoreCase } from '../common/utils'; import { getNonce, IRequestMessage, WebviewViewBase } from '../common/webview'; import { byRemoteName, @@ -397,6 +398,12 @@ export class CreatePullRequestViewProvider extends WebviewViewBase implements vs if (isBase) { newBranch = defaultBranch; this._baseBranch = defaultBranch; + if (compareIgnoreCase(this._baseRemote.owner, owner) !== 0 || compareIgnoreCase(this._baseRemote.repositoryName, repositoryName)) { + /* __GDPR__ + "pr.create.changedBaseRemote" : {} + */ + this._folderRepositoryManager.telemetry.sendTelemetryEvent('pr.create.changedBaseRemote'); + } this._baseRemote = { owner, repositoryName }; this._onDidChangeBaseRemote.fire({ owner, repositoryName }); this._onDidChangeBaseBranch.fire(defaultBranch); @@ -614,6 +621,12 @@ export class CreatePullRequestViewProvider extends WebviewViewBase implements vs private async changeBranch(newBranch: string, isBase: boolean): Promise<{ title: string, description: string }> { let compareBranch: Branch | undefined; if (isBase) { + if (this._baseBranch !== newBranch) { + /* __GDPR__ + "pr.create.changedBaseBranch" : {} + */ + this._folderRepositoryManager.telemetry.sendTelemetryEvent('pr.create.changedBaseBranch'); + } this._baseBranch = newBranch; this._onDidChangeBaseBranch.fire(newBranch); } else { diff --git a/src/github/createPRViewProviderNew.ts b/src/github/createPRViewProviderNew.ts index c0ffab1f87..134a863ef1 100644 --- a/src/github/createPRViewProviderNew.ts +++ b/src/github/createPRViewProviderNew.ts @@ -437,9 +437,17 @@ export class CreatePullRequestViewProviderNew extends WebviewViewBase implements defaultDescription: titleAndDescription.description }; if (baseRemoteChanged) { + /* __GDPR__ + "pr.create.changedBaseRemote" : {} + */ + this._folderRepositoryManager.telemetry.sendTelemetryEvent('pr.create.changedBaseRemote'); this._onDidChangeBaseRemote.fire(this._baseRemote); } if (baseBranchChanged) { + /* __GDPR__ + "pr.create.changedBaseBranch" : {} + */ + this._folderRepositoryManager.telemetry.sendTelemetryEvent('pr.create.changedBaseBranch'); this._onDidChangeBaseBranch.fire(this._baseBranch); } } else { @@ -449,6 +457,10 @@ export class CreatePullRequestViewProviderNew extends WebviewViewBase implements compareBranch: result.branch, defaultCompareBranch: defaultBranch }; + /* __GDPR__ + "pr.create.changedCompare" : {} + */ + this._folderRepositoryManager.telemetry.sendTelemetryEvent('pr.create.changedCompare'); this._onDidChangeCompareRemote.fire(result.remote); this._onDidChangeCompareBranch.fire(this._compareBranch); }