Skip to content

Commit a09b1cc

Browse files
committed
fixup: use telemetryAtlasUserId for all user reqs
1 parent 9c45ad7 commit a09b1cc

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

packages/compass-generative-ai/src/atlas-ai-service.spec.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ const ATLAS_USER = {
1515
sub: '123',
1616
};
1717

18-
const PREFERENCES_USER = {
19-
id: '1234',
20-
createdAt: new Date(),
21-
};
22-
2318
const BASE_URL = 'http://example.com';
2419

2520
const mockConnectionInfo: ConnectionInfo = {
@@ -68,7 +63,9 @@ describe('AtlasAiService', function () {
6863
beforeEach(async function () {
6964
sandbox = Sinon.createSandbox();
7065
preferences = await createSandboxFromDefaultPreferences();
71-
preferences['getPreferencesUser'] = () => PREFERENCES_USER;
66+
await preferences.savePreferences({
67+
telemetryAtlasUserId: '1234',
68+
});
7269
});
7370

7471
afterEach(function () {

packages/compass-generative-ai/src/atlas-ai-service.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,10 @@ export class AtlasAiService {
265265
const urlConfig = aiURLConfig[this.apiURLPreset][urlId];
266266
const urlPath =
267267
typeof urlConfig === 'function'
268-
? urlConfig(this.preferences.getPreferencesUser().id)
268+
? urlConfig(
269+
this.preferences.getPreferences().telemetryAtlasUserId ??
270+
new UUID().toString()
271+
)
269272
: urlConfig;
270273

271274
return this.atlasService.adminApiEndpoint(urlPath);

0 commit comments

Comments
 (0)