mirror of
https://github.com/mautrix/signal.git
synced 2025-03-14 14:15:36 +00:00
login: remove duplicate sync chats call
This commit is contained in:
parent
bd09149e63
commit
1e622b7bc6
2 changed files with 6 additions and 19 deletions
|
@ -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"})
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue