userinfo: prefer non-contacts as info source
This commit is contained in:
@@ -46,7 +46,8 @@ type GhostMetadata struct {
|
||||
Deleted bool `json:"deleted,omitempty"`
|
||||
NotMin bool `json:"not_min,omitempty"`
|
||||
|
||||
ContactSource int64 `json:"contact_source,omitempty"`
|
||||
ContactSource int64 `json:"contact_source,omitempty"`
|
||||
SourceIsContact bool `json:"source_is_contact,omitempty"`
|
||||
}
|
||||
|
||||
func (gm *GhostMetadata) IsMin() bool {
|
||||
|
||||
@@ -216,8 +216,9 @@ func (t *TelegramClient) wrapUserInfo(ctx context.Context, u tg.UserClass, ghost
|
||||
meta.IsBot = user.Bot
|
||||
meta.Deleted = user.Deleted
|
||||
meta.NotMin = true
|
||||
if meta.ContactSource == 0 {
|
||||
if meta.ContactSource == 0 || (!user.Contact && meta.SourceIsContact) {
|
||||
meta.ContactSource = t.telegramUserID
|
||||
meta.SourceIsContact = user.Contact
|
||||
}
|
||||
}
|
||||
return changed
|
||||
|
||||
Reference in New Issue
Block a user