From 84e01e07439ca0e5a9de3084dab9255bffc02e4b Mon Sep 17 00:00:00 2001 From: Harald Kirschner Date: Sun, 16 May 2021 20:53:30 -0700 Subject: [PATCH] Pipe language edit counts into CES survey --- .../contrib/surveys/browser/ces.contribution.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/surveys/browser/ces.contribution.ts b/src/vs/workbench/contrib/surveys/browser/ces.contribution.ts index d2c856bc64de2..d2e45ad101ac5 100644 --- a/src/vs/workbench/contrib/surveys/browser/ces.contribution.ts +++ b/src/vs/workbench/contrib/surveys/browser/ces.contribution.ts @@ -22,7 +22,7 @@ import { Disposable } from 'vs/base/common/lifecycle'; import { Event } from 'vs/base/common/event'; const WAIT_TIME_TO_SHOW_SURVEY = 1000 * 60 * 60; // 1 hour -const MIN_WAIT_TIME_TO_SHOW_SURVEY = 1000 * 60 * 5; // 5 minutes +const MIN_WAIT_TIME_TO_SHOW_SURVEY = 1000 * 60 * 2; // 2 minutes const MAX_INSTALL_AGE = 1000 * 60 * 60 * 24; // 24 hours const REMIND_LATER_DELAY = 1000 * 60 * 60 * 4; // 4 hours const SKIP_SURVEY_KEY = 'ces/skipSurvey'; @@ -78,7 +78,18 @@ class CESContribution extends Disposable implements IWorkbenchContribution { run: () => { sendTelemetry('accept'); this.telemetryService.getTelemetryInfo().then(info => { - this.openerService.open(URI.parse(`${this.productService.cesSurveyUrl}?o=${encodeURIComponent(platform)}&v=${encodeURIComponent(this.productService.version)}&m=${encodeURIComponent(info.machineId)}`)); + let surveyUrl = `${this.productService.cesSurveyUrl}?o=${encodeURIComponent(platform)}&v=${encodeURIComponent(this.productService.version)}&m=${encodeURIComponent(info.machineId)}`; + + const usedParams = this.productService.surveys + ?.filter(surveyData => surveyData.surveyId && surveyData.languageId) + // Counts provided by contrib/surveys/browser/languageSurveys + .filter(surveyData => this.storageService.getNumber(`${surveyData.surveyId}.editedCount`, StorageScope.GLOBAL, 0) > 0) + .map(surveyData => `${encodeURIComponent(surveyData.languageId)}Lang=1`) + .join('&'); + if (usedParams) { + surveyUrl += `&${usedParams}`; + } + this.openerService.open(URI.parse(surveyUrl)); this.skipSurvey(); }); }