From 066d16b522ec77c5c4a71120fd29b8086044f675 Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Sat, 1 Jul 2023 21:53:34 +0300 Subject: [PATCH] #1186 Renamed USER_IN_THREAD to USER_IN_TOPIC --- CHANGES/1161.feature.rst | 2 +- aiogram/fsm/strategy.py | 4 ++-- tests/test_fsm/test_strategy.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGES/1161.feature.rst b/CHANGES/1161.feature.rst index 819c697c..5a1e5927 100644 --- a/CHANGES/1161.feature.rst +++ b/CHANGES/1161.feature.rst @@ -7,7 +7,7 @@ The strategy can be changed in dispatcher: from aiogram.fsm.strategy import FSMStrategy ... dispatcher = Dispatcher( - fsm_strategy=FSMStrategy.USER_IN_THREAD, + fsm_strategy=FSMStrategy.USER_IN_TOPIC, storage=..., # Any persistent storage ) diff --git a/aiogram/fsm/strategy.py b/aiogram/fsm/strategy.py index 227924cb..2695d60e 100644 --- a/aiogram/fsm/strategy.py +++ b/aiogram/fsm/strategy.py @@ -6,7 +6,7 @@ class FSMStrategy(Enum): USER_IN_CHAT = auto() CHAT = auto() GLOBAL_USER = auto() - USER_IN_THREAD = auto() + USER_IN_TOPIC = auto() def apply_strategy( @@ -19,6 +19,6 @@ def apply_strategy( return chat_id, chat_id, None if strategy == FSMStrategy.GLOBAL_USER: return user_id, user_id, None - if strategy == FSMStrategy.USER_IN_THREAD: + if strategy == FSMStrategy.USER_IN_TOPIC: return chat_id, user_id, thread_id return chat_id, user_id, None diff --git a/tests/test_fsm/test_strategy.py b/tests/test_fsm/test_strategy.py index 3dab2b3d..782d1eeb 100644 --- a/tests/test_fsm/test_strategy.py +++ b/tests/test_fsm/test_strategy.py @@ -24,9 +24,9 @@ class TestStrategy: [FSMStrategy.GLOBAL_USER, CHAT, PRIVATE], [FSMStrategy.GLOBAL_USER, PRIVATE, PRIVATE], [FSMStrategy.GLOBAL_USER, THREAD, PRIVATE], - [FSMStrategy.USER_IN_THREAD, CHAT, CHAT], - [FSMStrategy.USER_IN_THREAD, PRIVATE, PRIVATE], - [FSMStrategy.USER_IN_THREAD, THREAD, THREAD], + [FSMStrategy.USER_IN_TOPIC, CHAT, CHAT], + [FSMStrategy.USER_IN_TOPIC, PRIVATE, PRIVATE], + [FSMStrategy.USER_IN_TOPIC, THREAD, THREAD], ], ) def test_strategy(self, strategy, case, expected):