Skip to content

Commit

Permalink
forge-notifications-display-list-function
Browse files Browse the repository at this point in the history
  • Loading branch information
tarsius committed Oct 3, 2023
1 parent 7874015 commit 1d74e4c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lisp/forge-notify.el
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
(setq forge-notifications-display-list-function
(magit-read-char-case "Display " t
(?a "[a]ll" #'forge--list-notifications-all)
(?m "[m]any" #'forge--list-notifications-many)
(?m "[r]ecent" #'forge--list-notifications-recent)
(?o "[o]pen" #'forge--list-notifications-open)
(?u "[u]nread" #'forge--list-notifications-unread)))
(magit-refresh))
Expand All @@ -130,12 +130,12 @@
(forge-sql [:select * :from notification
:order-by [(desc updated)]])))

(defun forge--list-notifications-many ()
(defun forge--list-notifications-recent ()
(mapcar (lambda (row)
(closql--remake-instance 'forge-notification (forge-db) row))
(forge-sql [:select * :from notification
:order-by [(desc updated)]
:limit 63])))
:limit 100])))

(defun forge--list-notifications-open ()
(mapcar (lambda (row)
Expand Down Expand Up @@ -167,7 +167,13 @@
(number-to-string (oref topic number)))))
notifs))))
(magit-insert-section (notifications)
(magit-insert-heading "Notifications:")
(magit-insert-heading
(concat (pcase forge-notifications-display-list-function
('forge--list-notifications-all "All")
('forge--list-notifications-recent "Recent")
('forge--list-notifications-open "Open")
('forge--list-notifications-unread "Unread"))
" notifications:"))
(if (eq forge-notifications-display-style 'flat)
(let ((repo-width
(apply #'max
Expand Down

0 comments on commit 1d74e4c

Please sign in to comment.