userinfo: prefer non-contacts as info source

This commit is contained in:
Tulir Asokan
2026-03-15 20:39:15 +02:00
parent d067348ac5
commit cfd9b74d34
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -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 {
+2 -1
View File
@@ -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