[Telemetry] Permanently hide the telemetry notice on dismissal (#159893)

This commit is contained in:
Alejandro Fernández Haro 2023-06-19 14:43:41 +02:00 committed by GitHub
parent 9fc99470a7
commit 14c5fffb24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -35,6 +35,6 @@ export function registerRoutes(options: RegisterRoutesParams) {
registerTelemetryConfigRoutes(options);
registerTelemetryUsageStatsRoutes(router, telemetryCollectionManager, isDev, getSecurity);
registerTelemetryOptInStatsRoutes(router, telemetryCollectionManager);
registerTelemetryUserHasSeenNotice(router);
registerTelemetryUserHasSeenNotice(router, options.currentKibanaVersion);
registerTelemetryLastReported(router, savedObjectsInternalClient$);
}

View file

@ -15,7 +15,7 @@ import {
updateTelemetrySavedObject,
} from '../saved_objects';
export function registerTelemetryUserHasSeenNotice(router: IRouter) {
export function registerTelemetryUserHasSeenNotice(router: IRouter, currentKibanaVersion: string) {
router.put(
{
path: '/api/telemetry/v2/userHasSeenNotice',
@ -31,6 +31,9 @@ export function registerTelemetryUserHasSeenNotice(router: IRouter) {
const updatedAttributes: TelemetrySavedObjectAttributes = {
...telemetrySavedObject,
userHasSeenNotice: true,
// We need to store that the user was notified in this version.
// Otherwise, it'll continuously show the banner if previously opted-out.
lastVersionChecked: currentKibanaVersion,
};
await updateTelemetrySavedObject(soClient, updatedAttributes);