Skip to content

Commit 083f102

Browse files
committed
Backport for "xPack:defaultAdminEmail" 7.x specific behaviour
1 parent 307c124 commit 083f102

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
let defaultEmailTo: string;
8+
9+
export const setDefaultEmailTo = (emailTo: string) => {
10+
defaultEmailTo = emailTo;
11+
};
12+
13+
export const getDefaultEmailTo = () => {
14+
return defaultEmailTo!;
15+
};

x-pack/legacy/plugins/watcher/public/np_ready/application/boot.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { SavedObjectsClientContract } from 'src/core/public';
1111
import { App, AppDeps } from './app';
1212
import { setHttpClient, setSavedObjectsClient } from './lib/api';
1313
import { LegacyDependencies } from '../types';
14+
import { setDefaultEmailTo } from './7_x_only';
1415

1516
interface BootDeps extends AppDeps {
1617
element: HTMLElement;
@@ -22,6 +23,7 @@ interface BootDeps extends AppDeps {
2223
export const boot = (bootDeps: BootDeps) => {
2324
const { I18nContext, element, legacy, savedObjects, ...appDeps } = bootDeps;
2425

26+
setDefaultEmailTo(bootDeps.uiSettings.get('xPack:defaultAdminEmail'));
2527
setHttpClient(appDeps.http);
2628
setSavedObjectsClient(savedObjects);
2729

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
import { get, isArray } from 'lodash';
88
import { BaseAction } from './base_action';
99
import { i18n } from '@kbn/i18n';
10+
import { getDefaultEmailTo } from '../../7_x_only';
1011

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

15-
const toArray = get(props, 'to');
16+
const toArray = get(props, 'to', getDefaultEmailTo());
1617

1718
this.to = isArray(toArray) ? toArray : toArray && [toArray];
1819

0 commit comments

Comments
 (0)