connector/login: fix crash on login
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
This commit is contained in:
@@ -68,7 +68,9 @@ func finalizeLogin(ctx context.Context, user *bridgev2.User, authorization *tg.A
|
||||
ul, err := user.NewLogin(ctx, &database.UserLogin{
|
||||
ID: userLoginID,
|
||||
Metadata: &metadata,
|
||||
}, nil)
|
||||
}, &bridgev2.NewLoginParams{
|
||||
DeleteOnConflict: true,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to save new login: %w", err)
|
||||
}
|
||||
@@ -118,6 +120,7 @@ func finalizeLogin(ctx context.Context, user *bridgev2.User, authorization *tg.A
|
||||
Instructions: fmt.Sprintf("Successfully logged in as %d / +%s (%s)", me.ID, me.Phone, remoteName),
|
||||
CompleteParams: &bridgev2.LoginCompleteParams{
|
||||
UserLoginID: ul.ID,
|
||||
UserLogin: ul,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -23,6 +23,10 @@ func (t *TelegramClient) SyncChats(ctx context.Context) error {
|
||||
if limit <= 0 {
|
||||
limit = math.MaxInt32
|
||||
}
|
||||
zerolog.Ctx(ctx).Info().
|
||||
Int("update_limit", limit).
|
||||
Int("create_limit", t.main.Config.Sync.CreateLimit).
|
||||
Msg("syncing chats")
|
||||
|
||||
dialogs, err := APICallWithUpdates(ctx, t, func() (tg.ModifiedMessagesDialogs, error) {
|
||||
d, err := t.client.API().MessagesGetDialogs(ctx, &tg.MessagesGetDialogsRequest{
|
||||
|
||||
Reference in New Issue
Block a user