aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-tl.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-11-19 11:27:51 +0100
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-11-19 11:27:51 +0100
commitaa41b5bd3a0176dc5650d9443298c963a4013887 (patch)
tree2b73b001f6d62617b7808e247d7bd3e094798cda /lisp/mastodon-tl.el
parentfbf796a7bdf98babfdbfc879c49db3defdc2577d (diff)
fix remove account from list, simplify --accounts-in-list
Diffstat (limited to 'lisp/mastodon-tl.el')
-rw-r--r--lisp/mastodon-tl.el22
1 files changed, 10 insertions, 12 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 9481fdc..4ef6b47 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -1639,22 +1639,20 @@ If ID is provided, use that list."
(account (completing-read "Account to remove: "
handles nil t))
(account-id (alist-get account handles nil nil 'equal))
- (url (mastodon-http--api (format "lists/%s/accounts" list-id)))
- (response (mastodon-http--delete url
- `(("account_ids[]" . ,account-id)))))
+ ;; letting --delete handle the params doesn't work
+ ;; so we do it here for now:
+ (base-url (mastodon-http--api (format "lists/%s/accounts" list-id)))
+ (args (mastodon-http--build-array-args-alist "account_ids[]" `(,account-id)))
+ (query-str (mastodon-http--build-query-string args))
+ (url (concat base-url "?" query-str))
+ (response (mastodon-http--delete url)))
(mastodon-http--triage response
(lambda ()
(message "%s removed from list %s!" account list-name)))))
-(defun mastodon-tl--accounts-in-list (&optional list-id)
- "Prompt for a list and return the JSON of the accounts in it.
-Use LIST-ID rather than prompting if given."
- (interactive)
- (let* ((list-name (unless list-id
- (completing-read "View accounts in list: "
- (mastodon-tl--get-lists-names) nil t)))
- (list-id (or list-id (mastodon-tl--get-list-id list-name)))
- (url (mastodon-http--api (format "lists/%s/accounts" list-id))))
+(defun mastodon-tl--accounts-in-list (list-id)
+ "Return the JSON of the accounts in list with LIST-ID."
+ (let* ((url (mastodon-http--api (format "lists/%s/accounts" list-id))))
(mastodon-http--get-json url)))
;;; FILTERS