From af75ef48a809c1cbd531723948847410be954d7d Mon Sep 17 00:00:00 2001 From: Alison Goryachev Date: Fri, 28 Jun 2019 15:41:34 -0400 Subject: [PATCH] Revert "Revert "remove deprecated xpack:defaultAdminEmail from email action"" This reverts commit 87ff8aa75960f485cdf7d6511cfebff5971d592c. --- .../plugins/watcher/public/models/action/email_action.js | 7 +++---- .../action_fields/email_action_fields.tsx | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/x-pack/legacy/plugins/watcher/public/models/action/email_action.js b/x-pack/legacy/plugins/watcher/public/models/action/email_action.js index 5d519825ad19b..3d04243579639 100644 --- a/x-pack/legacy/plugins/watcher/public/models/action/email_action.js +++ b/x-pack/legacy/plugins/watcher/public/models/action/email_action.js @@ -7,15 +7,13 @@ import { get, isArray } from 'lodash'; import { BaseAction } from './base_action'; import { i18n } from '@kbn/i18n'; -import chrome from 'ui/chrome'; export class EmailAction extends BaseAction { constructor(props = {}) { super(props); - const uiSettings = chrome.getUiSettingsClient(); - const defaultToEmail = uiSettings.get('xPack:defaultAdminEmail'); - const toArray = get(props, 'to', defaultToEmail); + const toArray = get(props, 'to'); + this.to = isArray(toArray) ? toArray : toArray && [ toArray ]; const defaultSubject = i18n.translate('xpack.watcher.models.emailAction.defaultSubjectText', { @@ -24,6 +22,7 @@ export class EmailAction extends BaseAction { context: '{{ctx.metadata.name}}', } }); + this.subject = get(props, 'subject', props.ignoreDefaults ? null : defaultSubject); this.body = get(props, 'body'); diff --git a/x-pack/legacy/plugins/watcher/public/sections/watch_edit/components/threshold_watch_edit/action_fields/email_action_fields.tsx b/x-pack/legacy/plugins/watcher/public/sections/watch_edit/components/threshold_watch_edit/action_fields/email_action_fields.tsx index c8f03cb9f8c63..08c7756fb4110 100644 --- a/x-pack/legacy/plugins/watcher/public/sections/watch_edit/components/threshold_watch_edit/action_fields/email_action_fields.tsx +++ b/x-pack/legacy/plugins/watcher/public/sections/watch_edit/components/threshold_watch_edit/action_fields/email_action_fields.tsx @@ -33,7 +33,7 @@ export const EmailActionFields: React.FunctionComponent = ({ errorKey="to" fullWidth errors={errors} - isShowingErrors={hasErrors && to !== null} + isShowingErrors={hasErrors && to !== undefined} label={i18n.translate( 'xpack.watcher.sections.watchEdit.threshold.emailAction.recipientTextFieldLabel', {