Add channel name to broadcasts

This commit is contained in:
Jack Kingsman
2026-03-06 14:05:54 -08:00
parent cba9835568
commit 929a931ce9
4 changed files with 5 additions and 0 deletions

View File

@@ -196,6 +196,7 @@ class Message(BaseModel):
outgoing: bool = False
acked: int = 0
sender_name: str | None = None
channel_name: str | None = None
class MessagesAroundResponse(BaseModel):

View File

@@ -208,6 +208,7 @@ async def create_message_from_decrypted(
paths=paths,
sender_name=sender,
sender_key=resolved_sender_key,
channel_name=channel_name,
).model_dump(),
realtime=trigger_bot,
)
@@ -301,6 +302,7 @@ async def create_dm_message_from_decrypted(
paths = [MessagePath(path=path or "", received_at=received)] if path is not None else None
# Broadcast new message to connected clients (and fanout modules when realtime)
sender_name = contact.name if contact and not outgoing else None
broadcast_event(
"message",
Message(

View File

@@ -172,6 +172,7 @@ export interface Message {
/** ACK count: 0 = not acked, 1+ = number of acks/flood echoes received */
acked: number;
sender_name: string | null;
channel_name?: string | null;
}
export interface MessagesAroundResponse {

View File

@@ -290,6 +290,7 @@ class TestContactMessageCLIFiltering:
"outgoing",
"acked",
"sender_name",
"channel_name",
}
with patch("app.event_handlers.broadcast_event") as mock_broadcast: