aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-http.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-07-13 15:14:57 +0200
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-07-13 15:14:57 +0200
commit46a31f419ce314bb55e5d53dc88cf6ddb8fa6f47 (patch)
treee60b51573478c6c369307e8d8683d087869b9e73 /lisp/mastodon-http.el
parent5f095822e92872ddcb76fc9fe98c0cf985849f3b (diff)
poss fix for simultaneous uploads. See #478.
Diffstat (limited to 'lisp/mastodon-http.el')
-rw-r--r--lisp/mastodon-http.el18
1 files changed, 10 insertions, 8 deletions
diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el
index 551d4fd..7d01e26 100644
--- a/lisp/mastodon-http.el
+++ b/lisp/mastodon-http.el
@@ -322,7 +322,15 @@ The upload is asynchronous. On succeeding,
`mastodon-toot--media-attachment-ids' is set to the id(s) of the
item uploaded, and `mastodon-toot--update-status-fields' is run."
(let* ((file (file-name-nondirectory filename))
- (request-backend 'curl))
+ (request-backend 'curl)
+ (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))))))
(request
url
:type "POST"
@@ -333,13 +341,7 @@ item uploaded, and `mastodon-toot--update-status-fields' is run."
:headers `(("Authorization" . ,(concat "Bearer "
(mastodon-auth--access-token))))
:sync nil
- :success (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 "Uploading %s... (done)" file)
- (mastodon-toot--update-status-fields))))
+ :success (apply-partially cb)
:error (cl-function
(lambda (&key error-thrown &allow-other-keys)
(cond