1
0
Fork 0
forked from External/ergo

fix: set the existing channels unregistered

This commit is contained in:
Shivaram Lingamneni 2019-02-11 23:30:49 -05:00
parent 370255bec1
commit e4c9351254
4 changed files with 23 additions and 19 deletions

View file

@ -842,8 +842,18 @@ func (am *AccountManager) Unregister(account string) error {
var clients []*Client
var registeredChannels []string
// on our way out, unregister all the account's channels and delete them from the db
defer func() {
am.server.channelRegistry.deleteByAccount(casefoldedAccount, registeredChannels)
for _, channelName := range registeredChannels {
info := am.server.channelRegistry.LoadChannel(channelName)
if info != nil && info.Founder == casefoldedAccount {
am.server.channelRegistry.Delete(channelName, *info)
}
channel := am.server.channels.Get(channelName)
if channel != nil {
channel.SetUnregistered(casefoldedAccount)
}
}
}()
var credText string