Allow displayname updates if ghost user has no name

This commit is contained in:
Tulir Asokan
2021-01-21 16:28:51 +02:00
parent 35f59b5f95
commit 97d47d80ee
2 changed files with 6 additions and 1 deletions
+3
View File
@@ -589,6 +589,9 @@ class PortalTelegram(BasePortal, ABC):
"displayname, updating info...")
entity = await source.client.get_entity(PeerUser(sender.tgid))
await sender.update_info(source, entity)
if not sender.displayname:
self.log.debug(f"Telegram user {sender.tgid} doesn't have a displayname even after"
f" updating with data {entity!s}")
allowed_media = (MessageMediaPhoto, MessageMediaDocument, MessageMediaGeo,
MessageMediaGame, MessageMediaDice, MessageMediaPoll,
+3 -1
View File
@@ -270,8 +270,10 @@ class Puppet(BasePuppet):
allow_because = "user is the primary source"
elif not isinstance(info, UpdateUserName) and not info.contact:
allow_because = "user is not a contact"
elif self.displayname_source is None:
elif not self.displayname_source:
allow_because = "no primary source set"
elif not self.displayname:
allow_because = "user has no name"
else:
return False