Update parseAlertNodesList to use nicknames with slack

pull/10616/head
Iris Scholten 2018-05-11 01:03:04 -07:00
parent c43c8bea63
commit 46a86ee28d
1 changed files with 17 additions and 1 deletions

View File

@ -47,8 +47,24 @@ export const parseAlertNodeList = rule => {
rule.alertNodes,
(acc, v, k) => {
if (k in HANDLERS_TO_RULE && v.length > 0) {
if (k === 'slack') {
_.reduce(
v,
(alerts, alert) => {
const nickname = _.get(alert, 'workspace') || 'default'
if (!alerts[nickname]) {
const fullHandler = `${k} (${nickname})`
alerts[nickname] = fullHandler
acc.push(fullHandler)
}
return alerts
},
{}
)
} else {
acc.push(k)
}
}
},
[]
)