aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-tl.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-02-18 22:35:45 +0100
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-02-18 22:35:45 +0100
commit08e0252d76adff14d0d3e3bdd236c774198ab2db (patch)
treeb33777c53fc041a1910f2be5129698848e391fda /lisp/mastodon-tl.el
parentb3692e0b9fac794208550b13ec5ea02ab0bd2907 (diff)
parent09d6011da215fced6b8f49f8cf12ee9226b58d8d (diff)
Merge branch 'develop' into buffer-type
Diffstat (limited to 'lisp/mastodon-tl.el')
-rw-r--r--lisp/mastodon-tl.el31
1 files changed, 18 insertions, 13 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 4ccfd20..5accc58 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -2779,16 +2779,21 @@ when showing followers or accounts followed."
(message "Loading older toots...")
(if (mastodon-tl--use-link-header-p)
;; link-header: can't build a URL with --more-json-async, endpoint/id:
- (let* ((next (car (mastodon-tl--link-header)))
- ;;(prev (cadr (mastodon-tl--link-header)))
- (url (mastodon-tl--build-link-header-url next)))
- (mastodon-http--get-response-async url nil 'mastodon-tl--more* (current-buffer)
- (point) :headers))
- (mastodon-tl--more-json-async
- (mastodon-tl--get-endpoint)
- (mastodon-tl--oldest-id)
- (mastodon-tl--update-params)
- 'mastodon-tl--more* (current-buffer) (point))))
+ ;; ensure we have a "next" type here, otherwise the CAR will be the
+ ;; "prev type!"
+ (let (link-header (mastodon-tl--link-header))
+ (if (> 2 (length link-header))
+ (error "No next page")
+ (let* ((next (car link-header))
+ ;;(prev (cadr (mastodon-tl--link-header)))
+ (url (mastodon-tl--build-link-header-url next)))
+ (mastodon-http--get-response-async url nil 'mastodon-tl--more* (current-buffer)
+ (point) :headers))
+ (mastodon-tl--more-json-async
+ (mastodon-tl--get-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.
@@ -3006,9 +3011,9 @@ This location is defined by a non-nil value of
(defun mastodon-tl--get-link-header-from-response (headers)
"Get http Link header from list of http HEADERS."
- (when headers
- ;; pleroma uses "link", so case-insensitive match required:
- (split-string (alist-get "Link" headers nil nil 'cl-equalp) ", ")))
+ ;; pleroma uses "link", so case-insensitive match required:
+ (when-let ((link-headers (alist-get "Link" headers nil nil 'cl-equalp)))
+ (split-string link-headers ", ")))
(defun mastodon-tl--init (buffer-name endpoint update-function
&optional headers params hide-replies)