Fix ConversationHandler.check_update not respecting per_user (#3128)

This commit is contained in:
Bibo-Joshi 2022-07-03 15:21:04 +02:00 committed by GitHub
parent f1d03393de
commit 2ecb8d5413
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View file

@ -693,6 +693,8 @@ class ConversationHandler(BaseHandler[Update, CCT]):
return None
if self.per_chat and not update.effective_chat:
return None
if self.per_user and not update.effective_user:
return None
if self.per_message and not update.callback_query:
return None
if update.callback_query and self.per_chat and not update.callback_query.message:

View file

@ -740,6 +740,12 @@ class TestConversationHandler:
],
bot=bot,
)
# First check that updates without user won't be handled
message.from_user = None
assert not handler.check_update(Update(update_id=0, message=message))
message.from_user = user1
async with app:
await app.process_update(Update(update_id=0, message=message))