Remove some dead code and unify param names around not sending for actual real life messages vs. historical decrypt

This commit is contained in:
Jack Kingsman
2026-03-06 14:11:23 -08:00
parent 9d03844371
commit d7d06ec1f8
4 changed files with 13 additions and 16 deletions
+7 -7
View File
@@ -129,7 +129,7 @@ async def create_message_from_decrypted(
received_at: int | None = None, received_at: int | None = None,
path: str | None = None, path: str | None = None,
channel_name: str | None = None, channel_name: str | None = None,
trigger_bot: bool = True, realtime: bool = True,
) -> int | None: ) -> int | None:
"""Create a message record from decrypted channel packet content. """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 timestamp: Sender timestamp from the packet
received_at: When the packet was received (defaults to now) received_at: When the packet was received (defaults to now)
path: Hex-encoded routing path 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. Returns the message ID if created, None if duplicate.
""" """
@@ -210,7 +210,7 @@ async def create_message_from_decrypted(
sender_key=resolved_sender_key, sender_key=resolved_sender_key,
channel_name=channel_name, channel_name=channel_name,
).model_dump(), ).model_dump(),
realtime=trigger_bot, realtime=realtime,
) )
return msg_id return msg_id
@@ -224,7 +224,7 @@ async def create_dm_message_from_decrypted(
received_at: int | None = None, received_at: int | None = None,
path: str | None = None, path: str | None = None,
outgoing: bool = False, outgoing: bool = False,
trigger_bot: bool = True, realtime: bool = True,
) -> int | None: ) -> int | None:
"""Create a message record from decrypted direct message packet content. """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) received_at: When the packet was received (defaults to now)
path: Hex-encoded routing path path: Hex-encoded routing path
outgoing: Whether this is an outgoing message (we sent it) 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. 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_name=sender_name,
sender_key=conversation_key if not outgoing else None, sender_key=conversation_key if not outgoing else None,
).model_dump(), ).model_dump(),
realtime=trigger_bot, realtime=realtime,
) )
# Update contact's last_contacted timestamp (for sorting) # Update contact's last_contacted timestamp (for sorting)
@@ -392,7 +392,7 @@ async def run_historical_dm_decryption(
received_at=packet_timestamp, received_at=packet_timestamp,
path=path_hex, path=path_hex,
outgoing=outgoing, 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: if msg_id is not None:
+1 -1
View File
@@ -71,7 +71,7 @@ async def _run_historical_channel_decryption(
timestamp=result.timestamp, timestamp=result.timestamp,
received_at=packet_timestamp, received_at=packet_timestamp,
path=path_hex, 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: if msg_id is not None:
@@ -481,11 +481,8 @@ function ScopeSelector({
selectedContacts.length >= filteredContacts.length); selectedContacts.length >= filteredContacts.length);
const showEmptyScopeWarning = messagesEffectivelyNone && !rawEnabled; const showEmptyScopeWarning = messagesEffectivelyNone && !rawEnabled;
// For "except" mode, checked means the item is in the exclusion list (will be excluded) const isChannelChecked = (key: string) => selectedChannels.includes(key);
const isChannelChecked = (key: string) => const isContactChecked = (key: string) => selectedContacts.includes(key);
mode === 'except' ? selectedChannels.includes(key) : selectedChannels.includes(key);
const isContactChecked = (key: string) =>
mode === 'except' ? selectedContacts.includes(key) : selectedContacts.includes(key);
const listHint = const listHint =
mode === 'only' mode === 'only'
+3 -3
View File
@@ -1852,8 +1852,8 @@ class TestRunHistoricalDmDecryption:
assert len(messages) == 0 assert len(messages) == 0
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_sets_trigger_bot_false(self, test_db, captured_broadcasts): async def test_sets_realtime_false(self, test_db, captured_broadcasts):
"""Historical decryption calls create_dm_message_from_decrypted with trigger_bot=False.""" """Historical decryption calls create_dm_message_from_decrypted with realtime=False."""
from app.packet_processor import run_historical_dm_decryption from app.packet_processor import run_historical_dm_decryption
raw = self._make_text_message_bytes(b"\x20") raw = self._make_text_message_bytes(b"\x20")
@@ -1891,7 +1891,7 @@ class TestRunHistoricalDmDecryption:
mock_create.assert_awaited_once() mock_create.assert_awaited_once()
call_kwargs = mock_create.call_args[1] call_kwargs = mock_create.call_args[1]
assert call_kwargs["trigger_bot"] is False assert call_kwargs["realtime"] is False
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_broadcasts_success_when_decrypted(self, test_db, captured_broadcasts): async def test_broadcasts_success_when_decrypted(self, test_db, captured_broadcasts):