Skip to content

Commit 87ff8aa

Browse files
Revert "remove deprecated xpack:defaultAdminEmail from email action"
This reverts commit ccecb29.
1 parent d3a9de3 commit 87ff8aa

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

x-pack/legacy/plugins/watcher/public/models/action/email_action.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77
import { get, isArray } from 'lodash';
88
import { BaseAction } from './base_action';
99
import { i18n } from '@kbn/i18n';
10+
import chrome from 'ui/chrome';
1011

1112
export class EmailAction extends BaseAction {
1213
constructor(props = {}) {
1314
super(props);
1415

15-
const toArray = get(props, 'to');
16-
16+
const uiSettings = chrome.getUiSettingsClient();
17+
const defaultToEmail = uiSettings.get('xPack:defaultAdminEmail');
18+
const toArray = get(props, 'to', defaultToEmail);
1719
this.to = isArray(toArray) ? toArray : toArray && [ toArray ];
1820

1921
const defaultSubject = i18n.translate('xpack.watcher.models.emailAction.defaultSubjectText', {
@@ -22,7 +24,6 @@ export class EmailAction extends BaseAction {
2224
context: '{{ctx.metadata.name}}',
2325
}
2426
});
25-
2627
this.subject = get(props, 'subject', props.ignoreDefaults ? null : defaultSubject);
2728

2829
this.body = get(props, 'body');

x-pack/legacy/plugins/watcher/public/sections/watch_edit/components/threshold_watch_edit/action_fields/email_action_fields.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const EmailActionFields: React.FunctionComponent<Props> = ({
3333
errorKey="to"
3434
fullWidth
3535
errors={errors}
36-
isShowingErrors={hasErrors && to !== undefined}
36+
isShowingErrors={hasErrors && to !== null}
3737
label={i18n.translate(
3838
'xpack.watcher.sections.watchEdit.threshold.emailAction.recipientTextFieldLabel',
3939
{

0 commit comments

Comments
 (0)