aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-toot.el
diff options
context:
space:
mode:
authormousebot <mousebot@riseup.net>2022-01-15 15:06:28 +0100
committermousebot <mousebot@riseup.net>2022-01-15 15:06:28 +0100
commitc8a1f4e982c31de97ab2c333513ca9f84ed16991 (patch)
tree9862843904f8845e9cfabb5749c537b71032e608 /lisp/mastodon-toot.el
parentb4a48b1e2d0a223024bac6940717866334176a9a (diff)
parenta6e43f8b4956e970b72f52e3a137e9a5cd43f2ed (diff)
Merge branch 'develop' into mpv-play-at-point
Diffstat (limited to 'lisp/mastodon-toot.el')
-rw-r--r--lisp/mastodon-toot.el19
1 files changed, 13 insertions, 6 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index befffee..746b7d4 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -162,11 +162,17 @@ Valid values are \"direct\", \"private\" (followers-only),
(defun mastodon-toot--get-max-toot-chars-callback (json-response)
"Set max_toot_chars returned in JSON-RESPONSE and display in new toot buffer."
- (setq mastodon-toot--max-toot-chars
- (number-to-string
- (alist-get 'max_toot_chars json-response)))
+ (let ((max-chars
+ (or
+ (alist-get 'max_toot_chars json-response)
+ ;; some servers have this instead:
+ (alist-get 'max_characters
+ (alist-get 'statuses
+ (alist-get 'configuration
+ json-response))))))
+ (setq mastodon-toot--max-toot-chars max-chars)
(with-current-buffer "*new toot*"
- (mastodon-toot--update-status-fields)))
+ (mastodon-toot--update-status-fields))))
(defun mastodon-toot--action-success (marker byline-region remove)
"Insert/remove the text MARKER with 'success face in byline.
@@ -493,7 +499,8 @@ If media items have been attached and uploaded with
(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))
+ ((and mastodon-toot--max-toot-chars
+ (> (length toot) 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."))
@@ -849,7 +856,7 @@ REPLY-JSON is the full JSON of the toot being replied to."
(list 'display
(format "%s/%s characters"
(- (point-max) (cdr header-region))
- mastodon-toot--max-toot-chars)))
+ (number-to-string mastodon-toot--max-toot-chars))))
(add-text-properties (car visibility-region) (cdr visibility-region)
(list 'display
(format "Visibility: %s"