From 073ef686839944abc16f85883be8db84c95592ae Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 1 Jun 2024 10:26:37 +0200 Subject: max-id arg/param for notifs-get --- lisp/mastodon-tl.el | 10 +++++----- lisp/mastodon.el | 6 ++++-- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'lisp') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index af1ce45..7ffa96d 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -2563,7 +2563,7 @@ Aims to respect any pagination in effect." ((eq type 'mentions) (mastodon-notifications--get-mentions)) ((eq type 'notifications) - (mastodon-notifications-get nil nil :force)) + (mastodon-notifications-get nil nil :force :max-id)) ((eq type 'profile-statuses-no-boosts) (mastodon-profile--open-statuses-no-reblogs)) ((eq type 'profile-statuses) @@ -2932,10 +2932,10 @@ JSON and http headers, without it just the JSON." link-header update-params hide-replies) (mastodon-tl--do-init json update-function instance))))))) - (defun mastodon-tl--init-sync - (buffer-name endpoint update-function - &optional note-type params headers view-name binding-str) - "Initialize BUFFER-NAME with timeline targeted by ENDPOINT. +(defun mastodon-tl--init-sync + (buffer-name endpoint update-function + &optional note-type params headers view-name binding-str) + "Initialize BUFFER-NAME with timeline targeted by ENDPOINT. UPDATE-FUNCTION is used to receive more toots. Runs synchronously. Optional arg NOTE-TYPE means only get that type of notification. diff --git a/lisp/mastodon.el b/lisp/mastodon.el index da3ffe2..42d9707 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -338,7 +338,7 @@ If REPLY-JSON is the json of the toot being replied to." (mastodon-toot--compose-buffer user reply-to-id reply-json)) ;;;###autoload -(defun mastodon-notifications-get (&optional type buffer-name force) +(defun mastodon-notifications-get (&optional type buffer-name force max-id) "Display NOTIFICATIONS in buffer. Optionally only print notifications of type TYPE, a string. BUFFER-NAME is added to \"*mastodon-\" to create the buffer name. @@ -356,7 +356,9 @@ from the server and load anew." (mastodon-tl--init-sync (or buffer-name "notifications") "notifications" 'mastodon-notifications--timeline - type) + type + (when max-id + `("max_id" . ,(mastodon-tl--buffer-property 'max-id)))) (with-current-buffer buffer (use-local-map mastodon-notifications--map))))) -- cgit v1.2.3