Add: (ement, ement-taxy) Unread notifications

This commit is contained in:
Adam Porter 2022-03-29 01:52:50 -05:00
parent 5ee6539df2
commit 324b4c725e
2 changed files with 12 additions and 2 deletions

View file

@ -204,6 +204,16 @@
(propertize formatted-ts 'face face))
"")))
(ement-taxy-define-column #("Unread" 0 6 (help-echo "Unread events (Notifications:Highlights")) (:align 'right)
(pcase-let* ((`[,(cl-struct ement-room unread-notifications) ,_session] item)
((map notification_count highlight_count) unread-notifications))
(if (or (not unread-notifications)
(and (equal 0 notification_count)
(equal 0 highlight_count)))
""
(format #("%s:%s" 0 5 (help-echo "Notifications:Highlights"))
notification_count highlight_count))))
(ement-taxy-define-column #("B" 0 1 (help-echo "Buffer exists for room")) ()
(pcase-let ((`[,(cl-struct ement-room (local (map buffer))) ,_session] item))
(if buffer #("B" 0 1 (help-echo "Buffer exists for room")) " ")))

View file

@ -728,8 +728,8 @@ Also used for left rooms, in which case TYPE should be set to
('unread_notifications unread-notifications))
event-types)
(latest-timestamp))
(ignore unread-notifications)
(setf (ement-room-type room) type)
(setf (ement-room-type room) type
(ement-room-unread-notifications room) unread-notifications)
;; NOTE: The idea is that, assuming that events in the sync reponse are in
;; chronological order, we push them to the lists in the room slots in that order,
;; leaving the head of each list as the most recent event of that type. That means