diff --git a/app/packet_processor.py b/app/packet_processor.py index 5595ea7..753c247 100644 --- a/app/packet_processor.py +++ b/app/packet_processor.py @@ -129,7 +129,7 @@ async def create_message_from_decrypted( received_at: int | None = None, path: str | None = None, channel_name: str | None = None, - trigger_bot: bool = True, + realtime: bool = True, ) -> int | None: """Create a message record from decrypted channel packet content. @@ -145,7 +145,7 @@ async def create_message_from_decrypted( timestamp: Sender timestamp from the packet received_at: When the packet was received (defaults to now) path: Hex-encoded routing path - trigger_bot: Whether to trigger bot response (False for historical decryption) + realtime: If False, skip fanout dispatch (used for historical decryption) Returns the message ID if created, None if duplicate. """ @@ -210,7 +210,7 @@ async def create_message_from_decrypted( sender_key=resolved_sender_key, channel_name=channel_name, ).model_dump(), - realtime=trigger_bot, + realtime=realtime, ) return msg_id @@ -224,7 +224,7 @@ async def create_dm_message_from_decrypted( received_at: int | None = None, path: str | None = None, outgoing: bool = False, - trigger_bot: bool = True, + realtime: bool = True, ) -> int | None: """Create a message record from decrypted direct message packet content. @@ -239,7 +239,7 @@ async def create_dm_message_from_decrypted( received_at: When the packet was received (defaults to now) path: Hex-encoded routing path outgoing: Whether this is an outgoing message (we sent it) - trigger_bot: Whether to trigger bot response (False for historical decryption) + realtime: If False, skip fanout dispatch (used for historical decryption) Returns the message ID if created, None if duplicate. """ @@ -317,7 +317,7 @@ async def create_dm_message_from_decrypted( sender_name=sender_name, sender_key=conversation_key if not outgoing else None, ).model_dump(), - realtime=trigger_bot, + realtime=realtime, ) # Update contact's last_contacted timestamp (for sorting) @@ -392,7 +392,7 @@ async def run_historical_dm_decryption( received_at=packet_timestamp, path=path_hex, outgoing=outgoing, - trigger_bot=False, # Historical decryption should not trigger bot + realtime=False, # Historical decryption should not trigger fanout ) if msg_id is not None: diff --git a/app/routers/packets.py b/app/routers/packets.py index 734e878..b08754b 100644 --- a/app/routers/packets.py +++ b/app/routers/packets.py @@ -71,7 +71,7 @@ async def _run_historical_channel_decryption( timestamp=result.timestamp, received_at=packet_timestamp, path=path_hex, - trigger_bot=False, # Historical decryption should not trigger bot + realtime=False, # Historical decryption should not trigger fanout ) if msg_id is not None: diff --git a/frontend/src/components/settings/SettingsFanoutSection.tsx b/frontend/src/components/settings/SettingsFanoutSection.tsx index 0925ede..4c2c137 100644 --- a/frontend/src/components/settings/SettingsFanoutSection.tsx +++ b/frontend/src/components/settings/SettingsFanoutSection.tsx @@ -481,11 +481,8 @@ function ScopeSelector({ selectedContacts.length >= filteredContacts.length); const showEmptyScopeWarning = messagesEffectivelyNone && !rawEnabled; - // For "except" mode, checked means the item is in the exclusion list (will be excluded) - const isChannelChecked = (key: string) => - mode === 'except' ? selectedChannels.includes(key) : selectedChannels.includes(key); - const isContactChecked = (key: string) => - mode === 'except' ? selectedContacts.includes(key) : selectedContacts.includes(key); + const isChannelChecked = (key: string) => selectedChannels.includes(key); + const isContactChecked = (key: string) => selectedContacts.includes(key); const listHint = mode === 'only' diff --git a/tests/test_packet_pipeline.py b/tests/test_packet_pipeline.py index af1a375..e351e9a 100644 --- a/tests/test_packet_pipeline.py +++ b/tests/test_packet_pipeline.py @@ -1852,8 +1852,8 @@ class TestRunHistoricalDmDecryption: assert len(messages) == 0 @pytest.mark.asyncio - async def test_sets_trigger_bot_false(self, test_db, captured_broadcasts): - """Historical decryption calls create_dm_message_from_decrypted with trigger_bot=False.""" + async def test_sets_realtime_false(self, test_db, captured_broadcasts): + """Historical decryption calls create_dm_message_from_decrypted with realtime=False.""" from app.packet_processor import run_historical_dm_decryption raw = self._make_text_message_bytes(b"\x20") @@ -1891,7 +1891,7 @@ class TestRunHistoricalDmDecryption: mock_create.assert_awaited_once() call_kwargs = mock_create.call_args[1] - assert call_kwargs["trigger_bot"] is False + assert call_kwargs["realtime"] is False @pytest.mark.asyncio async def test_broadcasts_success_when_decrypted(self, test_db, captured_broadcasts):