aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-10-14 19:17:30 +0200
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-10-14 19:17:30 +0200
commit312573f7ef4c0ebca511d2b8e44f50b090d44d37 (patch)
tree49bcf9e5e52079721b37d0b18348438ce1e548ee
parentf5094f4cb0bc527524b90fdb1cc2dd700c4b4851 (diff)
cond for more* pagination woes
-rw-r--r--lisp/mastodon-tl.el34
1 files changed, 18 insertions, 16 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index d2edd85..02c2dd7 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -2357,7 +2357,8 @@ when showing followers or accounts followed."
"Append older toots to timeline, asynchronously."
(message "Loading older toots...")
(if (mastodon-tl--use-link-header-p)
- ;; link-header: can't build a URL with --more-json-async, endpoint/id:
+ ;; link-header paginate:
+ ;; can't build a URL with --more-json-async, endpoint/id:
;; ensure we have a "next" type here, otherwise the CAR will be the
;; "prev" type!
(let ((link-header (mastodon-tl--link-header)))
@@ -2368,21 +2369,22 @@ when showing followers or accounts followed."
(url (mastodon-tl--build-link-header-url next)))
(mastodon-http--get-response-async url nil 'mastodon-tl--more* (current-buffer)
(point) :headers))))
- ;; offset (search, trending, user lists, ...?):
- (if (or (string-prefix-p "*mastodon-trending-" (buffer-name))
- (mastodon-tl--search-buffer-p))
- ;; Endpoints that do not implement: follow-suggestions,
- ;; follow-requests
- (mastodon-tl--more-json-async-offset
- (mastodon-tl--endpoint)
- (mastodon-tl--update-params)
- 'mastodon-tl--more* (current-buffer) (point))
- ;; max_id (timelines, items with ids/timestamps):
- (mastodon-tl--more-json-async
- (mastodon-tl--endpoint)
- (mastodon-tl--oldest-id)
- (mastodon-tl--update-params)
- 'mastodon-tl--more* (current-buffer) (point)))))
+ (cond ( ; no paginate
+ (mastodon-tl--buffer-type-eq 'follow-suggestions)
+ (message "No more results"))
+ ;; offset paginate (search, trending, user lists, ...?):
+ ((or (string-prefix-p "*mastodon-trending-" (buffer-name))
+ (mastodon-tl--search-buffer-p))
+ (mastodon-tl--more-json-async-offset
+ (mastodon-tl--endpoint)
+ (mastodon-tl--update-params)
+ 'mastodon-tl--more* (current-buffer) (point)))
+ (t;; max_id paginate (timelines, items with ids/timestamps):
+ (mastodon-tl--more-json-async
+ (mastodon-tl--endpoint)
+ (mastodon-tl--oldest-id)
+ (mastodon-tl--update-params)
+ 'mastodon-tl--more* (current-buffer) (point))))))
(defun mastodon-tl--more* (response buffer point-before &optional headers)
"Append older toots to timeline, asynchronously.