Fix resolving UpdateNewMessage sender in private chats

This commit is contained in:
Tulir Asokan
2020-10-23 23:41:46 +03:00
parent 686e26a503
commit 80aa557e0c
2 changed files with 7 additions and 12 deletions
+1 -6
View File
@@ -258,12 +258,7 @@ class User(AbstractUser, BaseUser):
return False
if isinstance(update, (UpdateNewMessage, UpdateNewChannelMessage)):
message = update.message
if isinstance(message.to_id, PeerUser) and not message.out:
portal = po.Portal.get_by_tgid(message.from_id, peer_type="user",
tg_receiver=self.tgid)
else:
portal = po.Portal.get_by_entity(message.to_id, receiver_id=self.tgid)
portal = po.Portal.get_by_entity(update.message.peer_id, receiver_id=self.tgid)
elif isinstance(update, UpdateShortChatMessage):
portal = po.Portal.get_by_tgid(TelegramID(update.chat_id))
elif isinstance(update, UpdateShortMessage):