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

View File

@@ -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:

View File

@@ -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:

View File

@@ -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'

View File

@@ -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):