login: remove duplicate sync chats call

This commit is contained in:
Tulir Asokan 2025-01-19 19:16:21 +02:00
parent bd09149e63
commit 1e622b7bc6
2 changed files with 6 additions and 19 deletions

View file

@ -206,16 +206,6 @@ func (s *SignalClient) bridgeStateLoop(statusChan <-chan signalmeow.SignalConnec
}
}
func (s *SignalClient) postLoginConnect(ctx context.Context) {
// TODO it would be more proper to only connect after syncing,
// but currently syncing will fetch group info online, so it has to be connected.
s.Connect(ctx)
s.syncChats(ctx)
if s.Client.Store.MasterKey != nil {
s.Client.SyncStorage(ctx)
}
}
func (s *SignalClient) Connect(ctx context.Context) {
if s.Client == nil {
s.UserLogin.BridgeState.Send(status.BridgeState{StateEvent: status.StateBadCredentials, Message: "You're not logged into Signal"})

View file

@ -176,15 +176,12 @@ func (qr *QRLogin) processingWait(ctx context.Context) (*bridgev2.LoginStep, err
}
backgroundCtx := ul.Log.WithContext(context.Background())
signalClient := ul.Client.(*SignalClient).Client
if signalClient.Store.EphemeralBackupKey != nil {
zerolog.Ctx(ctx).Info().Msg("Received ephemeral backup key in login, syncing chats before connecting")
go ul.Client.(*SignalClient).postLoginConnect(backgroundCtx)
} else {
ul.Client.Connect(backgroundCtx)
if signalClient.Store.MasterKey != nil {
zerolog.Ctx(ctx).Info().Msg("Received master key in login, syncing storage immediately")
go signalClient.SyncStorage(backgroundCtx)
}
// TODO it would be more proper to only connect after syncing,
// but currently syncing will fetch group info online, so it has to be connected.
ul.Client.Connect(backgroundCtx)
if signalClient.Store.MasterKey != nil {
zerolog.Ctx(ctx).Info().Msg("Received master key in login, syncing storage immediately")
go signalClient.SyncStorage(backgroundCtx)
}
return &bridgev2.LoginStep{
Type: bridgev2.LoginStepTypeComplete,