From 3ded5be6dcf964f35eec22a7efaaf74973d4d385 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Tue, 29 Nov 2022 16:00:30 +0100 Subject: cancel original scheduled toot if edited/rescheduled --- lisp/mastodon-toot.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'lisp/mastodon-toot.el') 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))) -- cgit v1.2.3