fix: show notifications and unread count for SSE messages arriving when chat closed
Three gaps caused messages received via SSE to be invisible when the conversation buffer wasn't already open: 1. Echo-area notification (noise-receive.el): when an SSE message arrives and the conversation buffer isn't in a visible window, show "[Noise] <name>" in the echo area. 2. Modeline unread counter (noise.el): the noise-mode lighter now shows Noise[N] for N unread messages via a lightweight SUM aggregation across all conversations. 3. Auto-refresh hook (noise-conversation.el): a window-buffer-change-functions hook re-renders *signal:* buffers when they become visible, covering direct C-x b switches. Also adds regression test: noise-receive-sse-stores-then-open-shows-message — store via SSE handler with no buffer open, then open and verify.
This commit is contained in:
@@ -245,5 +245,19 @@ NAME is the contact typing; ACTION is signal-cli's STARTED or STOPPED."
|
||||
(with-current-buffer buf
|
||||
(noise-chat-list--render))))
|
||||
|
||||
;;; Auto-refresh when conversation buffers become visible
|
||||
|
||||
(defun noise-conversation--on-buffer-visible (_frame)
|
||||
"Refresh any stale `*signal:*' conversation buffer that just became visible."
|
||||
(dolist (window (window-list nil 'never (selected-frame)))
|
||||
(when-let ((buf (window-buffer window)))
|
||||
(when (and (string-prefix-p "*signal:" (buffer-name buf))
|
||||
(not (string= "*signal*" (buffer-name buf))))
|
||||
(with-current-buffer buf
|
||||
(when (derived-mode-p 'noise-conversation-mode)
|
||||
(noise-conversation--render)))))))
|
||||
|
||||
(add-hook 'window-buffer-change-functions #'noise-conversation--on-buffer-visible)
|
||||
|
||||
(provide 'noise-conversation)
|
||||
;;; noise-conversation.el ends here
|
||||
|
||||
Reference in New Issue
Block a user