aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormousebot <mousebot@riseup.net>2021-12-17 13:00:02 +0100
committermousebot <mousebot@riseup.net>2021-12-17 13:00:02 +0100
commit7721f592731f1cdb8d4f36311dd9675580eb846b (patch)
treeeb14e116d21283ba50dd0c38dc3018e134771adc
parent2cc25a13872581eea9fc36b1ddc809f34cd3747a (diff)
parent5288ffc54c50d41cddcd432a258ada3f7f882a93 (diff)
Merge branch 'immed-async-media-upload' into develop
-rw-r--r--lisp/mastodon-toot.el33
1 files changed, 18 insertions, 15 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index 8d2df60..71bd3ad 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -468,24 +468,27 @@ If media items have been attached and uploaded with
(symbol-name t)))
("spoiler_text" . ,spoiler)))
(args-media (when mastodon-toot--media-attachments
- (if (= (length mastodon-toot--media-attachments)
- (length mastodon-toot--media-attachment-ids))
- ;; (mastodon-toot--upload-attached-media)
- ;; moved upload to mastodon-toot--attach-media
(mapcar (lambda (id)
(cons "media_ids[]" id))
- mastodon-toot--media-attachment-ids)
- (message "Looks like something went wrong with your uploads. Maybe you want to try again."))))
+ mastodon-toot--media-attachment-ids)))
(args (append args-media args-no-media)))
- (if (> (length toot) (string-to-number mastodon-toot--max-toot-chars))
- (message "Looks like your toot is longer than that maximum allowed length.")
- (if empty-toot-p
- (message "Empty toot. Cowardly refusing to post this.")
- (let ((response (mastodon-http--post endpoint args nil)))
- (mastodon-http--triage response
- (lambda ()
- (mastodon-toot--kill)
- (message "Toot toot!"))))))))
+ (cond ((and mastodon-toot--media-attachments
+ ;; make sure we have media args
+ ;; and the same num of ids as attachments
+ (or (not args-media)
+ (not (= (length mastodon-toot--media-attachments)
+ (length mastodon-toot--media-attachment-ids)))))
+ (message "Something is wrong with your uploads. Wait for them to complete or try again."))
+ ((> (length toot) (string-to-number mastodon-toot--max-toot-chars))
+ (message "Looks like your toot is longer than that maximum allowed length."))
+ (empty-toot-p
+ (message "Empty toot. Cowardly refusing to post this."))
+ (t
+ (let ((response (mastodon-http--post endpoint args nil)))
+ (mastodon-http--triage response
+ (lambda ()
+ (mastodon-toot--kill)
+ (message "Toot toot!"))))))))
(defun mastodon-toot--process-local (acct)
"Add domain to local ACCT and replace the curent user name with \"\".