aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-toot.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-11-29 16:00:30 +0100
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-11-29 16:00:30 +0100
commit3ded5be6dcf964f35eec22a7efaaf74973d4d385 (patch)
tree5919ae8532672b2b95d77e20be02bee9ef3a857f /lisp/mastodon-toot.el
parent679e15e955e0d7f4d204ea71aaeadaf26bfa690c (diff)
cancel original scheduled toot if edited/rescheduled
Diffstat (limited to 'lisp/mastodon-toot.el')
-rw-r--r--lisp/mastodon-toot.el13
1 files changed, 11 insertions, 2 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index 86c192b..c058296 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -727,7 +727,9 @@ instance to edit a toot."
(if mastodon-toot-poll
(append args-no-media args-poll)
args-no-media)))
- (prev-window-config mastodon-toot-previous-window-config))
+ (prev-window-config mastodon-toot-previous-window-config)
+ (scheduled mastodon-toot--scheduled-for)
+ (scheduled-id mastodon-toot--scheduled-id))
(cond ((and mastodon-toot--media-attachments
;; make sure we have media args
;; and the same num of ids as attachments
@@ -748,7 +750,13 @@ instance to edit a toot."
(mastodon-http--triage response
(lambda ()
(mastodon-toot--kill)
- (message "Toot toot!")
+ (if scheduled
+ (message "Toot scheduled!")
+ (message "Toot toot!"))
+ ;; cancel scheduled toot if we were editing it:
+ (when scheduled-id
+ (mastodon-tl--cancel-scheduled-toot
+ scheduled-id :no-confirm))
(mastodon-toot--restore-previous-window-config
prev-window-config))))))))
@@ -1155,6 +1163,7 @@ Return its two letter ISO 639 1 code."
With RESCHEDULE, reschedule the scheduled toot at point."
(interactive)
(let* ((id (when reschedule (get-text-property (point) 'id)))
+ ;; TODO if reschedule, set org-read-date to scheduled time
(time-value (org-read-date nil t nil "Schedule toot:"))
(iso8601-str (format-time-string "%FT%T%z" time-value))
(msg-str (format-time-string "%d-%m-%y at %H:%M[%z]" time-value)))