connector: only save access hash if not a min entity
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
This commit is contained in:
@@ -524,12 +524,13 @@ func (t *TelegramClient) getUserInfoFromTelegramUser(ctx context.Context, u tg.U
|
|||||||
return nil, fmt.Errorf("user is %T not *tg.User", user)
|
return nil, fmt.Errorf("user is %T not *tg.User", user)
|
||||||
}
|
}
|
||||||
var identifiers []string
|
var identifiers []string
|
||||||
if accessHash, ok := user.GetAccessHash(); ok {
|
|
||||||
if err := t.ScopedStore.SetAccessHash(ctx, ids.PeerTypeUser, user.ID, accessHash); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !user.Min {
|
if !user.Min {
|
||||||
|
if accessHash, ok := user.GetAccessHash(); ok {
|
||||||
|
if err := t.ScopedStore.SetAccessHash(ctx, ids.PeerTypeUser, user.ID, accessHash); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if err := t.ScopedStore.SetUsername(ctx, ids.PeerTypeUser, user.ID, user.Username); err != nil {
|
if err := t.ScopedStore.SetUsername(ctx, ids.PeerTypeUser, user.ID, user.Username); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -474,7 +474,8 @@ func (t *TelegramClient) updateGhost(ctx context.Context, userID int64, user *tg
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *TelegramClient) updateChannel(ctx context.Context, channel *tg.Channel) (*bridgev2.UserInfo, error) {
|
func (t *TelegramClient) updateChannel(ctx context.Context, channel *tg.Channel) (*bridgev2.UserInfo, error) {
|
||||||
if accessHash, ok := channel.GetAccessHash(); ok {
|
if accessHash, ok := channel.GetAccessHash(); ok && !channel.Min {
|
||||||
|
fmt.Printf("UPDATE CHANNEL HAS ACCESS HASH %d %d\n", channel.ID, accessHash)
|
||||||
if err := t.ScopedStore.SetAccessHash(ctx, ids.PeerTypeChannel, channel.ID, accessHash); err != nil {
|
if err := t.ScopedStore.SetAccessHash(ctx, ids.PeerTypeChannel, channel.ID, accessHash); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user