aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-toot.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-11-17 11:49:49 +0100
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-11-17 12:05:15 +0100
commit0996c7eabfd89e6bb5fa3c9f2558c9d6ac23a44b (patch)
tree2d0f5ece6ed9cc27f0bacb17a8aa8ef3920459bd /lisp/mastodon-toot.el
parent0bd8213302e4cbeb8483a2bef47f09cf2d8e9da2 (diff)
refactor array params into -http--build-array-args-alist
Diffstat (limited to 'lisp/mastodon-toot.el')
-rw-r--r--lisp/mastodon-toot.el16
1 files changed, 6 insertions, 10 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index 438e887..17a3938 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -79,6 +79,7 @@
(autoload 'mastodon-profile-fetch-server-account-settings "mastodon-profile")
(autoload 'mastodon-tl--render-text "mastodon-tl")
(autoload 'mastodon-profile-fetch-server-account-settings-maybe "mastodon-profile")
+(autoload 'mastodon-http--build-array-args-alist "mastodon-http")
;; for mastodon-toot--translate-toot-text
(autoload 'mastodon-tl--content "mastodon-tl")
@@ -615,7 +616,8 @@ to `emojify-user-emojis', and the emoji data is updated."
(defun mastodon-toot--build-poll-params ()
"Return an alist of parameters for POSTing a poll status."
(append
- (mastodon-toot--make-poll-options-params
+ (mastodon-http--build-array-args-alist
+ "poll[options][]"
(plist-get mastodon-toot-poll :options))
`(("poll[expires_in]" . ,(plist-get mastodon-toot-poll :expiry)))
`(("poll[multiple]" . ,(symbol-name (plist-get mastodon-toot-poll :multi))))
@@ -638,9 +640,9 @@ If media items have been attached and uploaded with
(symbol-name t)))
("spoiler_text" . ,spoiler)))
(args-media (when mastodon-toot--media-attachments
- (mapcar (lambda (id)
- (cons "media_ids[]" id))
- mastodon-toot--media-attachment-ids)))
+ (mastodon-http--build-array-args-alist
+ "media_ids[]"
+ mastodon-toot--media-attachment-ids)))
(args-poll (when mastodon-toot-poll
(mastodon-toot--build-poll-params)))
;; media || polls:
@@ -960,12 +962,6 @@ which is used to attach it to a toot when posting."
mastodon-toot--media-attachments))
(list "None")))
-(defun mastodon-toot--make-poll-options-params (options)
- "Return an parameter query alist from poll OPTIONS."
- (let ((key "poll[options][]"))
- (cl-loop for o in options
- collect `(,key . ,o))))
-
(defun mastodon-toot--fetch-max-poll-options ()
"Return the maximum number of poll options."
(mastodon-toot--fetch-poll-field 'max_options))