diff options
author | marty hiatt <martianhiatus@riseup.net> | 2024-06-01 10:39:50 +0200 |
---|---|---|
committer | marty hiatt <martianhiatus@riseup.net> | 2024-06-01 10:57:25 +0200 |
commit | 13162773b6fcff121bf3449075201a49547f68c4 (patch) | |
tree | a37cdb14f325cfb6962cb6c6652bdf5a58e18d41 /lisp/mastodon-profile.el | |
parent | 073ef686839944abc16f85883be8db84c95592ae (diff) |
max-id arg/params for (so far only plain) profile view
Diffstat (limited to 'lisp/mastodon-profile.el')
-rw-r--r-- | lisp/mastodon-profile.el | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 46a56f6..37a6ec4 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -146,7 +146,7 @@ This variable is set from data in (mastodon-tl--property 'item-json)) (defun mastodon-profile--make-author-buffer - (account &optional no-reblogs no-replies only-media tag) + (account &optional no-reblogs no-replies only-media tag max-id) "Take an ACCOUNT json and insert a user account into a new buffer. NO-REBLOGS means do not display boosts in statuses. NO-REPLIES means to exlude replies. @@ -154,7 +154,7 @@ ONLY-MEDIA means show only posts containing attachments. TAG is a hashtag to restrict posts to." (mastodon-profile--make-profile-buffer-for account "statuses" #'mastodon-tl--timeline no-reblogs nil - no-replies only-media tag)) + no-replies only-media tag max-id)) ;; TODO: we shd just load all views' data then switch coz this is slow af: (defun mastodon-profile--account-view-cycle () @@ -594,7 +594,7 @@ FIELDS means provide a fields vector fetched by other means." (defun mastodon-profile--make-profile-buffer-for (account endpoint-type update-function - &optional no-reblogs headers no-replies only-media tag) + &optional no-reblogs headers no-replies only-media tag max-id) "Display profile of ACCOUNT, using ENDPOINT-TYPE and UPDATE-FUNCTION. NO-REBLOGS means do not display boosts in statuses. HEADERS means also fetch link headers for pagination. @@ -602,7 +602,11 @@ NO-REPLIES means to exlude replies. ONLY-MEDIA means show only posts containing attachments. TAG is a hashtag to restrict posts to." (let-alist account - (let* ((args `(("limit" . ,mastodon-tl--timeline-posts-count))) + (let* ((max-id-str (when max-id + (mastodon-tl--buffer-property 'max-id))) + (args `(("limit" . ,mastodon-tl--timeline-posts-count) + ,(when max-id + `("max_id" . ,max-id-str)))) (args (cond (no-reblogs (push '("exclude_reblogs" . "t") args)) (no-replies @@ -637,9 +641,8 @@ TAG is a hashtag to restrict posts to." (mastodon-profile-mode) (remove-overlays) (setq mastodon-profile--account account) - (mastodon-tl--set-buffer-spec buffer endpoint - update-function link-header - args) + (mastodon-tl--set-buffer-spec buffer endpoint update-function + link-header args nil max-id-str) (let* ((inhibit-read-only t) (is-statuses (string= endpoint-type "statuses")) (is-followers (string= endpoint-type "followers")) @@ -748,12 +751,13 @@ the format \"2000-01-31T00:00:00.000Z\"." (format-time-string "Joined: %d %B %Y" (parse-iso8601-time-string joined))) -(defun mastodon-profile--get-toot-author () +(defun mastodon-profile--get-toot-author (&optional max-id) "Open profile of author of toot under point. If toot is a boost, opens the profile of the booster." (interactive) (mastodon-profile--make-author-buffer - (alist-get 'account (mastodon-profile--item-json)))) + (alist-get 'account (mastodon-profile--item-json)) + nil nil nil nil max-id)) (defun mastodon-profile--image-from-account (account img-type) "Return a avatar image from ACCOUNT. |