fix(irc): append invite command on add (#297)

This commit is contained in:
Ludvig Lundgren 2022-06-11 02:05:31 +02:00 committed by GitHub
parent ffada19506
commit df7a51d479
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 0 deletions

View file

@ -556,6 +556,14 @@ func (s *service) StoreNetwork(ctx context.Context, network *domain.IrcNetwork)
existingNetwork.Channels = append(existingNetwork.Channels, network.Channels...)
}
// append invite command for existing network
if network.InviteCommand != "" {
existingNetwork.InviteCommand = strings.Join([]string{existingNetwork.InviteCommand, network.InviteCommand}, ",")
if err := s.repo.UpdateInviteCommand(existingNetwork.ID, existingNetwork.InviteCommand); err != nil {
return err
}
}
if existingNetwork.Enabled {
// if server, tls, invite command, port : changed - restart
// if nickserv account, nickserv password : changed - stay connected, and change those