fix(mailservers)_: ToggleUseMailservers should connect/disconnect from active store node
fixes status-im/status-desktop#15032
This commit is contained in:
parent
173bdb590c
commit
fe588c7a79
|
@ -151,7 +151,18 @@ func (m *Messenger) cycleMailservers() {
|
|||
m.disconnectActiveMailserver()
|
||||
}
|
||||
|
||||
err := m.findNewMailserver()
|
||||
useMailserver, err := m.settings.CanUseMailservers()
|
||||
if err != nil {
|
||||
m.logger.Error("failed to get use mailservers", zap.Error(err))
|
||||
return
|
||||
}
|
||||
|
||||
if !useMailserver {
|
||||
m.logger.Info("Skipping mailserver search due to useMailserver being false")
|
||||
return
|
||||
}
|
||||
|
||||
err = m.findNewMailserver()
|
||||
if err != nil {
|
||||
m.logger.Error("Error getting new mailserver", zap.Error(err))
|
||||
}
|
||||
|
|
|
@ -342,3 +342,15 @@ func (s *MessengerStoreNodeCommunitySuite) TestSetStorenodeForCommunity_fetchMes
|
|||
})
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
|
||||
func (s *MessengerStoreNodeCommunitySuite) TestToggleUseMailservers() {
|
||||
// Enable use of mailservers
|
||||
err := s.owner.ToggleUseMailservers(true)
|
||||
s.Require().NoError(err)
|
||||
s.Require().NotNil(s.owner.mailserverCycle.activeMailserver)
|
||||
|
||||
// Disable use of mailservers
|
||||
err = s.owner.ToggleUseMailservers(false)
|
||||
s.Require().NoError(err)
|
||||
s.Require().Nil(s.owner.mailserverCycle.activeMailserver)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue