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:
parent
3fd71cd316
commit
8392037e5f
4 changed files with 110 additions and 23 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue