[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/mastodon b078849b53 11/52: implement link-header paginatio
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/mastodon b078849b53 11/52: implement link-header pagination for foll-reqs |
Date: |
Mon, 30 Oct 2023 16:01:24 -0400 (EDT) |
branch: elpa/mastodon
commit b078849b534ddaaebdaf45ebee89d2fe59f3f696
Author: marty hiatt <martianhiatus [a t] riseup [d o t] net>
Commit: marty hiatt <martianhiatus [a t] riseup [d o t] net>
implement link-header pagination for foll-reqs
---
lisp/mastodon-tl.el | 18 +++++++++++-------
lisp/mastodon-views.el | 3 ++-
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 02c2dd7034..d5d127db52 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -2340,12 +2340,13 @@ POS is a number, where point will be placed."
(defun mastodon-tl--use-link-header-p ()
"Return t if we are in a view needing Link header pagination.
-Currently this includes favourites, bookmarks, and profile pages
-when showing followers or accounts followed."
+Currently this includes favourites, bookmarks, follow requests,
+and profile pages when showing followers or accounts followed."
(or (mastodon-tl--buffer-type-eq 'favourites)
(mastodon-tl--buffer-type-eq 'bookmarks)
(mastodon-tl--buffer-type-eq 'profile-followers)
- (mastodon-tl--buffer-type-eq 'profile-following)))
+ (mastodon-tl--buffer-type-eq 'profile-following)
+ (mastodon-tl--buffer-type-eq 'follow-requests)))
(defun mastodon-tl--get-link-header-from-response (headers)
"Get http Link header from list of http HEADERS."
@@ -2363,7 +2364,7 @@ when showing followers or accounts followed."
;; "prev" type!
(let ((link-header (mastodon-tl--link-header)))
(if (> 2 (length link-header))
- (error "No next page")
+ (message "No next page")
(let* ((next (car link-header))
;;(prev (cadr (mastodon-tl--link-header)))
(url (mastodon-tl--build-link-header-url next)))
@@ -2656,7 +2657,7 @@ JSON and http headers, without it just the JSON."
(mastodon-tl--do-init json update-function))))))
(defun mastodon-tl--init-sync (buffer-name endpoint update-function
- &optional note-type params)
+ &optional note-type params headers)
"Initialize BUFFER-NAME with timeline targeted by ENDPOINT.
UPDATE-FUNCTION is used to receive more toots.
Runs synchronously.
@@ -2670,9 +2671,12 @@ Optional arg NOTE-TYPE means only get that type of note."
(params (append notes-params params))
(url (mastodon-http--api endpoint))
(buffer (concat "*mastodon-" buffer-name "*"))
- (json (mastodon-http--get-json url params)))
+ (response (mastodon-http--get-response url params))
+ (json (if headers (car response) response))
+ (headers (if headers (cdr response) nil))
+ (link-header (mastodon-tl--get-link-header-from-response headers)))
(with-mastodon-buffer buffer #'mastodon-mode nil
- (mastodon-tl--set-buffer-spec buffer endpoint update-function nil params)
+ (mastodon-tl--set-buffer-spec buffer endpoint update-function
link-header params)
(mastodon-tl--do-init json update-function)
buffer)))
diff --git a/lisp/mastodon-views.el b/lisp/mastodon-views.el
index dd46b59241..20734ae413 100644
--- a/lisp/mastodon-views.el
+++ b/lisp/mastodon-views.el
@@ -461,7 +461,8 @@ JSON is the data returned by the server."
"follow_requests"
'mastodon-views--insert-follow-requests
nil
- '(("limit" . "80"))) ; server max
+ '(("limit" . "40")) ; server max is 80
+ :headers)
(mastodon-tl--goto-first-item)
(with-current-buffer "*mastodon-follow-requests*"
(use-local-map mastodon-views--view-follow-requests-keymap)))
- [nongnu] elpa/mastodon updated (cd2d6f23b4 -> a8c80d25b7), ELPA Syncer, 2023/10/30
- [nongnu] elpa/mastodon 6eadcf1716 01/52: tests docstring, ELPA Syncer, 2023/10/30
- [nongnu] elpa/mastodon 45fd842fe2 03/52: goto-too-pos: add masto-tab-stop second prop, ELPA Syncer, 2023/10/30
- [nongnu] elpa/mastodon 267b8f9fff 04/52: refactor/rename mastodon-search--insert-heading, ELPA Syncer, 2023/10/30
- [nongnu] elpa/mastodon 50e9fc677f 06/52: fix pagination for trending tags, ELPA Syncer, 2023/10/30
- [nongnu] elpa/mastodon 153b1682d0 07/52: more*: msg when response is nil, ELPA Syncer, 2023/10/30
- [nongnu] elpa/mastodon b078849b53 11/52: implement link-header pagination for foll-reqs,
ELPA Syncer <=
- [nongnu] elpa/mastodon a672c056a8 15/52: fix init-sync for notifs-get compat with link-header/get-response, ELPA Syncer, 2023/10/30
- [nongnu] elpa/mastodon dd5a34bb8d 18/52: remove "toots" from more msging, as its now (more) generic, ELPA Syncer, 2023/10/30
- [nongnu] elpa/mastodon d59b8d0f8b 22/52: next-/prev-toot>next-/prev-item, cond-case around pos update call, ELPA Syncer, 2023/10/30
- [nongnu] elpa/mastodon 8eda8fb5fa 24/52: fix rename do-if-item-strict, ELPA Syncer, 2023/10/30
- [nongnu] elpa/mastodon 506ec82941 29/52: tl--prev-toot-id: don't assume our funs return anything., ELPA Syncer, 2023/10/30
- [nongnu] elpa/mastodon 979f95575a 43/52: note re tags timeline limit number of tags, ELPA Syncer, 2023/10/30
- [nongnu] elpa/mastodon c18aee5421 44/52: request-auth-code: select-enable-clipboard., ELPA Syncer, 2023/10/30
- [nongnu] elpa/mastodon 8404082b69 02/52: move scroll up cmd, ELPA Syncer, 2023/10/30
- [nongnu] elpa/mastodon d710763757 05/52: add .elpaignore file, ELPA Syncer, 2023/10/30
- [nongnu] elpa/mastodon f5094f4cb0 09/52: add params arg to init-sync, use limit param for foll_reqs/sugests, ELPA Syncer, 2023/10/30