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

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
This commit is contained in:
Ganesh Vernekar 2021-05-20 14:00:09 +05:30 committed by GitHub
parent f166b22b52
commit 95ee5f01b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 == "" {