Skip to content

Commit e93006a

Browse files
chore: remove closed survey VSCODE-659 (#888)
1 parent b489a80 commit e93006a

File tree

4 files changed

+3
-243
lines changed

4 files changed

+3
-243
lines changed

src/mdbExtensionController.ts

Lines changed: 3 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ import launchMongoShell from './commands/launchMongoShell';
3333
import type SchemaTreeItem from './explorer/schemaTreeItem';
3434
import { StatusView } from './views';
3535
import { StorageController, StorageVariables } from './storage';
36-
import TelemetryService, {
37-
TelemetryEventTypes,
38-
} from './telemetry/telemetryService';
36+
import TelemetryService from './telemetry/telemetryService';
3937
import type PlaygroundsTreeItem from './explorer/playgroundsTreeItem';
4038
import PlaygroundResultProvider from './editors/playgroundResultProvider';
4139
import WebviewController from './views/webviewController';
@@ -166,7 +164,8 @@ export default class MDBExtensionController implements vscode.Disposable {
166164

167165
this.registerCommands();
168166
this.showOverviewPageIfRecentlyInstalled();
169-
void this.showSurveyForEstablishedUsers();
167+
168+
// ------ In-app notifications ------ //
170169
void this.showCopilotIntroductionForEstablishedUsers();
171170

172171
const copilot = vscode.extensions.getExtension('GitHub.copilot');
@@ -974,54 +973,6 @@ export default class MDBExtensionController implements vscode.Disposable {
974973
);
975974
}
976975

977-
async showSurveyForEstablishedUsers(): Promise<void> {
978-
const surveyId = '9viN9wcbsC3zvHyg7';
979-
980-
const hasBeenShownSurveyAlready =
981-
this._storageController.get(StorageVariables.GLOBAL_SURVEY_SHOWN) ===
982-
surveyId;
983-
984-
// Show the toast when startup notifications have not been shown
985-
// to the user yet and they have saved connections
986-
// -> they haven't just started using this extension
987-
if (
988-
this._startupNotificationShown ||
989-
hasBeenShownSurveyAlready ||
990-
!this._connectionStorage.hasSavedConnections()
991-
) {
992-
return;
993-
}
994-
995-
this._startupNotificationShown = true;
996-
997-
const action = 'Share your thoughts';
998-
const text = 'How can we make the MongoDB extension better for you?';
999-
const link = 'https://forms.gle/9viN9wcbsC3zvHyg7';
1000-
const result = await vscode.window.showInformationMessage(
1001-
text,
1002-
{},
1003-
{
1004-
title: action,
1005-
}
1006-
);
1007-
if (result?.title === action) {
1008-
void vscode.env.openExternal(vscode.Uri.parse(link));
1009-
this._telemetryService.track(TelemetryEventTypes.SURVEY_CLICKED, {
1010-
survey_id: surveyId,
1011-
});
1012-
} else {
1013-
this._telemetryService.track(TelemetryEventTypes.SURVEY_DISMISSED, {
1014-
survey_id: surveyId,
1015-
});
1016-
}
1017-
1018-
// whether action was taken or the prompt dismissed, we won't show this again
1019-
void this._storageController.update(
1020-
StorageVariables.GLOBAL_SURVEY_SHOWN,
1021-
surveyId
1022-
);
1023-
}
1024-
1025976
async dispose(): Promise<void> {
1026977
await this.deactivate();
1027978
}

src/storage/storageController.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import type { StoreConnectionInfo } from './connectionStorage';
66
export enum StorageVariables {
77
// Only exists on globalState.
88
GLOBAL_HAS_BEEN_SHOWN_INITIAL_VIEW = 'GLOBAL_HAS_BEEN_SHOWN_INITIAL_VIEW',
9-
GLOBAL_SURVEY_SHOWN = 'GLOBAL_SURVEY_SHOWN',
109
GLOBAL_COPILOT_INTRODUCTION_SHOWN = 'GLOBAL_COPILOT_INTRODUCTION_SHOWN',
1110
GLOBAL_SAVED_CONNECTIONS = 'GLOBAL_SAVED_CONNECTIONS',
1211
// Analytics user identify.
@@ -53,7 +52,6 @@ interface StorageVariableContents {
5352
[StorageVariables.GLOBAL_USER_ID]: string;
5453
[StorageVariables.GLOBAL_ANONYMOUS_ID]: string;
5554
[StorageVariables.GLOBAL_HAS_BEEN_SHOWN_INITIAL_VIEW]: boolean;
56-
[StorageVariables.GLOBAL_SURVEY_SHOWN]: string;
5755
[StorageVariables.GLOBAL_COPILOT_INTRODUCTION_SHOWN]: boolean;
5856
[StorageVariables.GLOBAL_SAVED_CONNECTIONS]: ConnectionsFromStorage;
5957
[StorageVariables.WORKSPACE_SAVED_CONNECTIONS]: ConnectionsFromStorage;

src/telemetry/telemetryService.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,6 @@ type ConnectionEditedTelemetryEventProperties = {
7777
success: boolean;
7878
};
7979

80-
type SurveyActionProperties = {
81-
survey_id: string;
82-
};
83-
8480
type SavedConnectionsLoadedProperties = {
8581
// Total number of connections saved on disk
8682
saved_connections: number;
@@ -157,7 +153,6 @@ type TelemetryEventProperties =
157153
| PlaygroundLoadedTelemetryEventProperties
158154
| KeytarSecretsMigrationFailedProperties
159155
| SavedConnectionsLoadedProperties
160-
| SurveyActionProperties
161156
| ParticipantFeedbackProperties
162157
| ParticipantResponseFailedProperties
163158
| ParticipantPromptProperties
@@ -179,8 +174,6 @@ export enum TelemetryEventTypes {
179174
PLAYGROUND_CREATED = 'Playground Created',
180175
KEYTAR_SECRETS_MIGRATION_FAILED = 'Keytar Secrets Migration Failed',
181176
SAVED_CONNECTIONS_LOADED = 'Saved Connections Loaded',
182-
SURVEY_CLICKED = 'Survey link clicked',
183-
SURVEY_DISMISSED = 'Survey prompt dismissed',
184177
PARTICIPANT_FEEDBACK = 'Participant Feedback',
185178
PARTICIPANT_WELCOME_SHOWN = 'Participant Welcome Shown',
186179
PARTICIPANT_RESPONSE_FAILED = 'Participant Response Failed',

src/test/suite/mdbExtensionController.test.ts

Lines changed: 0 additions & 182 deletions
Original file line numberDiff line numberDiff line change
@@ -175,14 +175,12 @@ suite('MDBExtensionController Test Suite', function () {
175175
let fakeActiveConnectionId: SinonSpy;
176176
let showErrorMessageStub: SinonStub;
177177
let fakeCreatePlaygroundFileWithContent: SinonSpy;
178-
let openExternalStub: SinonStub;
179178

180179
beforeEach(() => {
181180
showInformationMessageStub = sandbox.stub(
182181
vscode.window,
183182
'showInformationMessage'
184183
);
185-
openExternalStub = sandbox.stub(vscode.env, 'openExternal');
186184
openTextDocumentStub = sandbox.stub(vscode.workspace, 'openTextDocument');
187185
fakeActiveConnectionId = sandbox.fake.returns('tasty_sandwich');
188186
sandbox.replace(
@@ -1715,186 +1713,6 @@ suite('MDBExtensionController Test Suite', function () {
17151713
});
17161714
});
17171715

1718-
suite('survey prompt', function () {
1719-
suite(
1720-
'when a user has been shown the startup notification already',
1721-
function () {
1722-
beforeEach(() => {
1723-
sandbox
1724-
.stub(
1725-
mdbTestExtension.testExtensionController,
1726-
'_startupNotificationShown'
1727-
)
1728-
.get(function getterFn() {
1729-
return true;
1730-
});
1731-
});
1732-
1733-
test('they are not shown the survey prompt', () => {
1734-
assert(showInformationMessageStub.notCalled);
1735-
});
1736-
}
1737-
);
1738-
1739-
suite(
1740-
"when a user hasn't been shown the survey prompt yet, and they have connections saved",
1741-
() => {
1742-
[
1743-
{
1744-
description: 'clicked the button',
1745-
value: { title: 'Share your thoughts' },
1746-
},
1747-
{ description: 'dismissed', value: undefined },
1748-
].forEach((reaction) => {
1749-
suite(`user ${reaction.description}`, () => {
1750-
let connectionsUpdateStub: SinonStub;
1751-
let uriParseStub: SinonStub;
1752-
beforeEach(async () => {
1753-
sandbox
1754-
.stub(
1755-
mdbTestExtension.testExtensionController,
1756-
'_startupNotificationShown'
1757-
)
1758-
.set(function setterFn() {})
1759-
.get(function getterFn() {
1760-
return false;
1761-
});
1762-
showInformationMessageStub.resolves(reaction.value);
1763-
openExternalStub.resolves(undefined);
1764-
sandbox.replace(
1765-
mdbTestExtension.testExtensionController._storageController,
1766-
'get',
1767-
sandbox.fake.returns(undefined)
1768-
);
1769-
sandbox.replace(
1770-
mdbTestExtension.testExtensionController._connectionStorage,
1771-
'hasSavedConnections',
1772-
sandbox.fake.returns(true)
1773-
);
1774-
connectionsUpdateStub = sandbox.stub(
1775-
mdbTestExtension.testExtensionController._storageController,
1776-
'update'
1777-
);
1778-
uriParseStub = sandbox.stub(vscode.Uri, 'parse');
1779-
connectionsUpdateStub.resolves(undefined);
1780-
await mdbTestExtension.testExtensionController.showSurveyForEstablishedUsers();
1781-
});
1782-
1783-
afterEach(() => {
1784-
sandbox.restore();
1785-
});
1786-
1787-
test('they are shown the survey prompt', () => {
1788-
assert(showInformationMessageStub.called);
1789-
assert.strictEqual(
1790-
showInformationMessageStub.firstCall.args[0],
1791-
'How can we make the MongoDB extension better for you?'
1792-
);
1793-
});
1794-
1795-
test('the link was open if and only if they click the button', () => {
1796-
if (reaction.value === undefined) {
1797-
assert(openExternalStub.notCalled);
1798-
}
1799-
if (reaction.value) {
1800-
assert(openExternalStub.called);
1801-
assert(uriParseStub.called);
1802-
assert.strictEqual(
1803-
uriParseStub.firstCall.args[0],
1804-
'https://forms.gle/9viN9wcbsC3zvHyg7'
1805-
);
1806-
}
1807-
});
1808-
1809-
test("it sets that they've been shown the survey", () => {
1810-
assert(connectionsUpdateStub.called);
1811-
assert.strictEqual(
1812-
connectionsUpdateStub.firstCall.args[0],
1813-
StorageVariables.GLOBAL_SURVEY_SHOWN
1814-
);
1815-
assert.strictEqual(
1816-
connectionsUpdateStub.firstCall.args[1],
1817-
'9viN9wcbsC3zvHyg7'
1818-
);
1819-
});
1820-
});
1821-
});
1822-
}
1823-
);
1824-
1825-
suite('when a user has been shown the survey prompt already', () => {
1826-
let connectionsUpdateStub: SinonStub;
1827-
beforeEach(() => {
1828-
sandbox
1829-
.stub(
1830-
mdbTestExtension.testExtensionController,
1831-
'_startupNotificationShown'
1832-
)
1833-
.set(function setterFn() {})
1834-
.get(function getterFn() {
1835-
return false;
1836-
});
1837-
sandbox.replace(
1838-
mdbTestExtension.testExtensionController._storageController,
1839-
'get',
1840-
sandbox.fake.returns('9viN9wcbsC3zvHyg7') // survey has been shown
1841-
);
1842-
sandbox.replace(
1843-
mdbTestExtension.testExtensionController._connectionStorage,
1844-
'hasSavedConnections',
1845-
sandbox.fake.returns(true)
1846-
);
1847-
connectionsUpdateStub = sandbox.stub(
1848-
mdbTestExtension.testExtensionController._storageController,
1849-
'update'
1850-
);
1851-
connectionsUpdateStub.resolves(undefined);
1852-
1853-
void mdbTestExtension.testExtensionController.showSurveyForEstablishedUsers();
1854-
});
1855-
1856-
test('they are not shown the survey prompt', () => {
1857-
assert(showInformationMessageStub.notCalled);
1858-
});
1859-
});
1860-
1861-
suite('when a has no connections saved', () => {
1862-
let connectionsUpdateStub: SinonStub;
1863-
beforeEach(() => {
1864-
sandbox
1865-
.stub(
1866-
mdbTestExtension.testExtensionController,
1867-
'_startupNotificationShown'
1868-
)
1869-
.set(function setterFn() {})
1870-
.get(function getterFn() {
1871-
return false;
1872-
});
1873-
sandbox.replace(
1874-
mdbTestExtension.testExtensionController._storageController,
1875-
'get',
1876-
sandbox.fake.returns(undefined)
1877-
);
1878-
sandbox.replace(
1879-
mdbTestExtension.testExtensionController._connectionStorage,
1880-
'hasSavedConnections',
1881-
sandbox.fake.returns(false) // no connections yet - this might be the first install
1882-
);
1883-
connectionsUpdateStub = sandbox.stub(
1884-
mdbTestExtension.testExtensionController._storageController,
1885-
'update'
1886-
);
1887-
connectionsUpdateStub.resolves(undefined);
1888-
1889-
void mdbTestExtension.testExtensionController.showSurveyForEstablishedUsers();
1890-
});
1891-
1892-
test('they are not shown the survey prompt', () => {
1893-
assert(showInformationMessageStub.notCalled);
1894-
});
1895-
});
1896-
});
1897-
18981716
suite('copilot introduction prompt', function () {
18991717
suite(
19001718
'when a user has been shown the startup notification already',

0 commit comments

Comments
 (0)