From 46f4ba2c27f45b32e0e0f74a3e03601b603d48ec Mon Sep 17 00:00:00 2001 From: Mike Cote Date: Wed, 13 Nov 2019 10:05:57 -0500 Subject: [PATCH 1/3] Change optIn to default to true --- src/legacy/core_plugins/telemetry/index.ts | 6 ++---- .../telemetry/public/components/telemetry_form.js | 2 +- .../server/telemetry_config/get_telemetry_opt_in.ts | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/legacy/core_plugins/telemetry/index.ts b/src/legacy/core_plugins/telemetry/index.ts index 149fa99938563..cb8df5dba1e60 100644 --- a/src/legacy/core_plugins/telemetry/index.ts +++ b/src/legacy/core_plugins/telemetry/index.ts @@ -50,10 +50,8 @@ const telemetry = (kibana: any) => { allowChangingOptInStatus: Joi.boolean().default(true), optIn: Joi.when('allowChangingOptInStatus', { is: false, - then: Joi.valid(true).required(), - otherwise: Joi.boolean() - .allow(null) - .default(null), + then: Joi.valid(true).default(true), + otherwise: Joi.boolean().default(true), }), // `config` is used internally and not intended to be set diff --git a/src/legacy/core_plugins/telemetry/public/components/telemetry_form.js b/src/legacy/core_plugins/telemetry/public/components/telemetry_form.js index 80eb2da59c47e..e92f2266fa15f 100644 --- a/src/legacy/core_plugins/telemetry/public/components/telemetry_form.js +++ b/src/legacy/core_plugins/telemetry/public/components/telemetry_form.js @@ -116,7 +116,7 @@ export class TelemetryForm extends Component { type: 'boolean', value: telemetryOptInProvider.getOptIn() || false, description: this.renderDescription(), - defVal: false, + defVal: true, }} save={this.toggleOptIn} clear={this.toggleOptIn} diff --git a/src/legacy/core_plugins/telemetry/server/telemetry_config/get_telemetry_opt_in.ts b/src/legacy/core_plugins/telemetry/server/telemetry_config/get_telemetry_opt_in.ts index 057a8b0c47958..d83ffdf69b576 100644 --- a/src/legacy/core_plugins/telemetry/server/telemetry_config/get_telemetry_opt_in.ts +++ b/src/legacy/core_plugins/telemetry/server/telemetry_config/get_telemetry_opt_in.ts @@ -44,7 +44,7 @@ export const getTelemetryOptIn: GetTelemetryOptIn = ({ } if (telemetrySavedObject === null || typeof telemetrySavedObject.enabled !== 'boolean') { - return null; + return configTelemetryOptIn; } const savedOptIn = telemetrySavedObject.enabled; From 6958b5feb31386c13ba0c3710b7345568ecde82d Mon Sep 17 00:00:00 2001 From: Mike Cote Date: Wed, 13 Nov 2019 11:22:04 -0500 Subject: [PATCH 2/3] Update snapshot --- .../public/components/__snapshots__/telemetry_form.test.js.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/legacy/core_plugins/telemetry/public/components/__snapshots__/telemetry_form.test.js.snap b/src/legacy/core_plugins/telemetry/public/components/__snapshots__/telemetry_form.test.js.snap index b96313fd700ac..268616f7115d4 100644 --- a/src/legacy/core_plugins/telemetry/public/components/__snapshots__/telemetry_form.test.js.snap +++ b/src/legacy/core_plugins/telemetry/public/components/__snapshots__/telemetry_form.test.js.snap @@ -34,7 +34,7 @@ exports[`TelemetryForm renders as expected when allows to change optIn status 1` save={[Function]} setting={ Object { - "defVal": false, + "defVal": true, "description":

Help us improve the Elastic Stack by providing usage statistics for basic features. We will not share this data outside of Elastic. From aa47d03822e2befa7d97fda8ad457f877ea87f7d Mon Sep 17 00:00:00 2001 From: Mike Cote Date: Wed, 13 Nov 2019 12:42:29 -0500 Subject: [PATCH 3/3] Fix eslint errors --- src/plugins/newsfeed/public/lib/api.test.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/plugins/newsfeed/public/lib/api.test.ts b/src/plugins/newsfeed/public/lib/api.test.ts index b9707ff91b936..4383b9e0f7dab 100644 --- a/src/plugins/newsfeed/public/lib/api.test.ts +++ b/src/plugins/newsfeed/public/lib/api.test.ts @@ -631,10 +631,7 @@ describe('getApi', () => { .mockImplementationOnce(getHttpMockWithItems(successItems)); getApi(httpMock, configMock.newsfeed, '6.8.2') - .pipe( - take(4), - toArray() - ) + .pipe(take(4), toArray()) .subscribe(result => { expect(result).toMatchInlineSnapshot(` Array [