Forward whole message to FE on resend so the browser updates

This commit is contained in:
Jack Kingsman
2026-03-13 21:57:19 -07:00
parent f41c7756d3
commit 39a687da58
8 changed files with 149 additions and 6 deletions
+6
View File
@@ -347,6 +347,12 @@ class MessagesAroundResponse(BaseModel):
has_newer: bool
class ResendChannelMessageResponse(BaseModel):
status: str
message_id: int
message: Message | None = None
class RawPacketDecryptedInfo(BaseModel):
"""Decryption info for a raw packet (when successfully decrypted)."""
+7 -2
View File
@@ -8,6 +8,7 @@ from app.event_handlers import track_pending_ack
from app.models import (
Message,
MessagesAroundResponse,
ResendChannelMessageResponse,
SendChannelMessageRequest,
SendDirectMessageRequest,
)
@@ -171,11 +172,15 @@ async def send_channel_message(request: SendChannelMessageRequest) -> Message:
RESEND_WINDOW_SECONDS = 30
@router.post("/channel/{message_id}/resend")
@router.post(
"/channel/{message_id}/resend",
response_model=ResendChannelMessageResponse,
response_model_exclude_none=True,
)
async def resend_channel_message(
message_id: int,
new_timestamp: bool = Query(default=False),
) -> dict:
) -> dict[str, object]:
"""Resend a channel message.
When new_timestamp=False (default): byte-perfect resend using the original timestamp.
+1 -1
View File
@@ -530,7 +530,7 @@ async def resend_channel_message_record(
new_message.id,
channel.name,
)
return {"status": "ok", "message_id": new_message.id}
return {"status": "ok", "message_id": new_message.id, "message": new_message}
logger.info("Resent channel message %d to %s", message.id, channel.name)
return {"status": "ok", "message_id": message.id}