Skip to content

Commit

Permalink
[8.8] [Telemetry] Permanently hide the telemetry notice on dismissal (#…
Browse files Browse the repository at this point in the history
…159893) (#159922)

# Backport

This will backport the following commits from `main` to `8.8`:
- [[Telemetry] Permanently hide the telemetry notice on dismissal
(#159893)](#159893)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Alejandro Fernández
Haro","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-06-19T12:43:41Z","message":"[Telemetry]
Permanently hide the telemetry notice on dismissal
(#159893)","sha":"14c5fffb24f25eb19e185582289a00ee71cf33af","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:fix","Feature:Telemetry","backport:prev-minor","v8.9.0"],"number":159893,"url":"https://github.com/elastic/kibana/pull/159893","mergeCommit":{"message":"[Telemetry]
Permanently hide the telemetry notice on dismissal
(#159893)","sha":"14c5fffb24f25eb19e185582289a00ee71cf33af"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/159893","number":159893,"mergeCommit":{"message":"[Telemetry]
Permanently hide the telemetry notice on dismissal
(#159893)","sha":"14c5fffb24f25eb19e185582289a00ee71cf33af"}}]}]
BACKPORT-->

Co-authored-by: Alejandro Fernández Haro <[email protected]>
  • Loading branch information
kibanamachine and afharo authored Jun 19, 2023
1 parent 1147d38 commit 8109a55
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/plugins/telemetry/server/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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$);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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);

Expand Down

0 comments on commit 8109a55

Please sign in to comment.