Skip to content

Commit

Permalink
Revert "Revert "remove deprecated xpack:defaultAdminEmail from email …
Browse files Browse the repository at this point in the history
…action""

This reverts commit 87ff8aa.
  • Loading branch information
alisonelizabeth committed Jun 28, 2019
1 parent c0e9ae2 commit af75ef4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand All @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const EmailActionFields: React.FunctionComponent<Props> = ({
errorKey="to"
fullWidth
errors={errors}
isShowingErrors={hasErrors && to !== null}
isShowingErrors={hasErrors && to !== undefined}
label={i18n.translate(
'xpack.watcher.sections.watchEdit.threshold.emailAction.recipientTextFieldLabel',
{
Expand Down

0 comments on commit af75ef4

Please sign in to comment.