feat(messages): auto-open/flash dock on incoming + persist dock across reload

The live-message push now carries both parties, so an incoming message opens
that conversation's dock window if it's closed, or flashes it once if it's
already open (expanded or minimised, without disturbing the minimised state) —
only for messages from someone else, never your own echo.

Dock state (open windows + minimised state) is persisted per user, so a reload
restores exactly what was open, minimised, or closed.
This commit is contained in:
2026-06-25 22:46:54 +02:00
parent 91522d9689
commit 44e9e33354
4 changed files with 110 additions and 23 deletions
+8 -1
View File
@@ -325,7 +325,14 @@ def send_message(
db.add(m)
db.commit()
db.refresh(m)
event = {"type": "message", "message": _serialize_msg(m)}
# Carry both parties so each recipient can open/flash the right dock window (the partner is
# whichever of from/to isn't them).
event = {
"type": "message",
"message": _serialize_msg(m),
"from": _serialize_user(user),
"to": _serialize_user(recipient),
}
manager.push(recipient.id, event)
manager.push(user.id, event) # the sender's other open devices
return _serialize_msg(m)