aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/mastodon-notifications.el12
-rw-r--r--lisp/mastodon-tl.el20
2 files changed, 22 insertions, 10 deletions
diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el
index c2d1962..debc760 100644
--- a/lisp/mastodon-notifications.el
+++ b/lisp/mastodon-notifications.el
@@ -355,11 +355,8 @@ ACCOUNTS is the notification accounts data."
(if (member type '("follow" "follow_request"))
toot))) ;; account data!
'item-type 'toot ;; for nav, actions, etc.
- 'item-id (or
- ;; grouped notifications pagination max_id:
- ;; NB: their min id used for our max id param
- (alist-get 'page_min_id group)
- (alist-get 'id toot)) ; toot id
+ 'item-id (or (alist-get 'page_max_id group) ;; newest notif
+ (alist-get 'id toot)) ; toot id
'base-item-id (mastodon-tl--item-id
;; if status is a notif, get id from base-toot
;; (-tl--item-id toot) will not work here:
@@ -373,7 +370,10 @@ ACCOUNTS is the notification accounts data."
;; grouped notifs data:
'notification-type type
'notification-group group
- 'notification-accounts accounts)
+ 'notification-accounts accounts
+ ;; for pagination:
+ 'notifications-min-id (alist-get 'page_min_id group)
+ 'notifications-max-id (alist-get 'page_max_id group))
"\n")))
;; FIXME: REFACTOR with -tl--byline?:
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 6005a54..99663ac 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -2216,16 +2216,28 @@ BACKWARD means move backward (up) the timeline."
(get-text-property (point) prop)))))
(defun mastodon-tl--newest-id ()
- "Return item-id from the top of the buffer."
+ "Return item-id from the top of the buffer.
+If we are in a notifications view, return `notifications-max-id'."
(save-excursion
(goto-char (point-min))
- (mastodon-tl--property 'item-id)))
+ (mastodon-tl--property
+ (if (eq (mastodon-tl--get-buffer-type)
+ (member (mastodon-tl--get-buffer-type)
+ '(mentions notifications)))
+ 'notifications-max-id
+ 'item-id))))
(defun mastodon-tl--oldest-id ()
- "Return item-id from the bottom of the buffer."
+ "Return item-id from the bottom of the buffer.
+If we are in a notifications view, return `notifications-min-id'."
(save-excursion
(goto-char (point-max))
- (mastodon-tl--property 'item-id nil :backward)))
+ (mastodon-tl--property
+ (if (member (mastodon-tl--get-buffer-type)
+ '(mentions notifications))
+ 'notifications-min-id
+ 'item-id)
+ nil :backward)))
(defun mastodon-tl--as-string (numeric)
"Convert NUMERIC to string."