NGAlert: Do not pick a random default channel if no default exists (#34465)

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
pull/34467/head
Ganesh Vernekar 5 years ago committed by GitHub
parent f166b22b52
commit 95ee5f01b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      pkg/services/sqlstore/migrations/ualert/channel.go

@ -204,19 +204,6 @@ func (m *migration) updateDefaultAndUnmigratedChannels(amConfig *PostableUserCon
}
// Default route and receiver.
if len(defaultChannels) == 0 {
// Pick one from the migrated channels. Preference to email channel.
for c := range m.migratedChannels {
if len(defaultChannels) == 0 {
defaultChannels = append(defaultChannels, c)
}
if c.Type == "email" {
defaultChannels[0] = c
break
}
}
}
var channelUids = []interface{}{}
for _, c := range defaultChannels {
if c.Uid == "" {

Loading…
Cancel
Save