mirror of https://github.com/grafana/grafana
Chore: Pass signed `user_hash` to Intercom via Rudderstack (#63921)
* move analytics identifiers to backend
* implement hash function
* grab secret from env
* expose and retrieve intercom secret from config
* concat email with appUrl to ensure uniqueness
* revert to just using email
* Revert "revert to just using email"
This reverts commit 8f10f9b1bc.
* add docstring
pull/63424/head
parent
fed59b1d43
commit
d61bcdf4ca
@ -1,41 +0,0 @@ |
||||
import { CurrentUserDTO, OrgRole } from '@grafana/data'; |
||||
|
||||
import { getUserIdentifier } from './utils'; |
||||
|
||||
const baseUser: CurrentUserDTO = { |
||||
isSignedIn: true, |
||||
id: 3, |
||||
login: 'myUsername', |
||||
email: 'email@example.com', |
||||
name: 'My Name', |
||||
theme: 'dark', |
||||
lightTheme: false, // deprecated
|
||||
orgCount: 1, |
||||
orgId: 1, |
||||
orgName: 'Main Org.', |
||||
orgRole: OrgRole.Admin, |
||||
isGrafanaAdmin: false, |
||||
gravatarUrl: '/avatar/abc-123', |
||||
timezone: 'browser', |
||||
weekStart: 'browser', |
||||
locale: 'en-AU', |
||||
language: 'en-US', |
||||
externalUserId: '', |
||||
}; |
||||
|
||||
const gcomUser: CurrentUserDTO = { |
||||
...baseUser, |
||||
externalUserId: 'abc-123', |
||||
}; |
||||
|
||||
describe('echo getUserIdentifier', () => { |
||||
it('should return the external user ID (gcom ID) if available', () => { |
||||
const id = getUserIdentifier(gcomUser); |
||||
expect(id).toBe('abc-123'); |
||||
}); |
||||
|
||||
it('should fall back to the email address', () => { |
||||
const id = getUserIdentifier(baseUser); |
||||
expect(id).toBe('email@example.com'); |
||||
}); |
||||
}); |
||||
Loading…
Reference in new issue