aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-10-14 19:06:57 +0200
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-10-14 19:06:57 +0200
commitf5094f4cb0bc527524b90fdb1cc2dd700c4b4851 (patch)
tree180b8a7097db627f65916acf6976b5d32b03fa10 /lisp
parentf8ab918cf298a5719f1df044669436137b172484 (diff)
add params arg to init-sync, use limit param for foll_reqs/sugests
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mastodon-tl.el13
-rw-r--r--lisp/mastodon-views.el10
2 files changed, 16 insertions, 7 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index ddf3d0e..d2edd85 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -2654,20 +2654,23 @@ 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)
+ &optional note-type params)
"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 note."
+ ;; Used by `mastodon-notifications-get' and in views.el
(let* ((exclude-types (when note-type
(mastodon-notifications--filter-types-list note-type)))
- (args (when note-type (mastodon-http--build-array-params-alist
- "exclude_types[]" exclude-types)))
+ (notes-params (when note-type
+ (mastodon-http--build-array-params-alist
+ "exclude_types[]" exclude-types)))
+ (params (append notes-params params))
(url (mastodon-http--api endpoint))
(buffer (concat "*mastodon-" buffer-name "*"))
- (json (mastodon-http--get-json url args)))
+ (json (mastodon-http--get-json url params)))
(with-mastodon-buffer buffer #'mastodon-mode nil
- (mastodon-tl--set-buffer-spec buffer endpoint update-function nil args)
+ (mastodon-tl--set-buffer-spec buffer endpoint update-function nil params)
(mastodon-tl--do-init json update-function)
buffer)))
diff --git a/lisp/mastodon-views.el b/lisp/mastodon-views.el
index 8110e50..dd46b59 100644
--- a/lisp/mastodon-views.el
+++ b/lisp/mastodon-views.el
@@ -443,6 +443,7 @@ If ID is provided, use that list."
;;; FOLLOW REQUESTS
+;; TODO: paginates by link header
(defun mastodon-views--insert-follow-requests (json)
"Insert the user's current follow requests.
@@ -458,7 +459,9 @@ JSON is the data returned by the server."
(interactive)
(mastodon-tl--init-sync "follow-requests"
"follow_requests"
- 'mastodon-views--insert-follow-requests)
+ 'mastodon-views--insert-follow-requests
+ nil
+ '(("limit" . "80"))) ; server max
(mastodon-tl--goto-first-item)
(with-current-buffer "*mastodon-follow-requests*"
(use-local-map mastodon-views--view-follow-requests-keymap)))
@@ -650,13 +653,16 @@ Prompt for a context, must be a list containting at least one of \"home\",
;;; FOLLOW SUGGESTIONS
+;; No pagination: max 80 results
(defun mastodon-views--view-follow-suggestions ()
"Display a buffer of suggested accounts to follow."
(interactive)
(mastodon-tl--init-sync "follow-suggestions"
"suggestions"
- 'mastodon-views--insert-follow-suggestions)
+ 'mastodon-views--insert-follow-suggestions
+ nil
+ '(("limit" . "80"))) ; server max
(with-current-buffer "*mastodon-follow-suggestions*"
(use-local-map mastodon-views--follow-suggestions-map)))