aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-http.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus@riseup.net>2024-03-16 11:27:41 +0100
committermarty hiatt <martianhiatus@riseup.net>2024-03-16 11:40:05 +0100
commit3c1d3150e1be8fe23948a0adb0f5341227532fb5 (patch)
treebfd2686ce73f39051cef981481da20590d40152c /lisp/mastodon-http.el
parent9249cda2fffca34223d6d6c485878c3a1b32766d (diff)
PUT attachment alt-text in media upload callback. (pleroma)
Diffstat (limited to 'lisp/mastodon-http.el')
-rw-r--r--lisp/mastodon-http.el21
1 files changed, 15 insertions, 6 deletions
diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el
index aef8975..49c94a4 100644
--- a/lisp/mastodon-http.el
+++ b/lisp/mastodon-http.el
@@ -338,18 +338,27 @@ The upload is asynchronous. On succeeding,
item uploaded, and `mastodon-toot--update-status-fields' is run."
(let* ((file (file-name-nondirectory filename))
(request-backend 'curl)
+ (desc `(("description" . ,caption)))
(cb (cl-function
(lambda (&key data &allow-other-keys)
(when data
- (push (alist-get 'id data)
- mastodon-toot--media-attachment-ids) ; add ID to list
- (message (alist-get 'id data))
- (message "Uploading %s... (done)" file)
- (mastodon-toot--update-status-fields))))))
+ (let* ((id (alist-get 'id data)))
+ ;; update ids:
+ (push id mastodon-toot--media-attachment-ids)
+ ;; pleroma, PUT the description:
+ ;; this is how the mangane akkoma web client does it
+ ;; and it seems easier than the other options!
+ (when (and caption
+ (not (equal caption (alist-get 'description data))))
+ (let ((url (mastodon-http--api (format "media/%s" id))))
+ ;; (message "PUTting image description")
+ (mastodon-http--put url desc)))
+ (message "Uploading %s... (done)" file)
+ (mastodon-toot--update-status-fields)))))))
(request
url
:type "POST"
- :params `(("description" . ,caption))
+ :params desc
:files `(("file" . (,file :file ,filename
:mime-type "multipart/form-data")))
:parser 'json-read