mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-03-13 11:18:20 +01:00
Fix ConversationHandler.check_update
not respecting per_user
(#3128)
This commit is contained in:
parent
f1d03393de
commit
2ecb8d5413
2 changed files with 8 additions and 0 deletions
|
@ -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:
|
||||
|
|
|
@ -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))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue