aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/mastodon-tl.el9
-rw-r--r--lisp/mastodon-toot.el13
2 files changed, 16 insertions, 6 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 8ce2333..6971673 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -1913,11 +1913,11 @@ If ID, just return that toot."
(text (alist-get 'text params)))
(kill-new text)))
-(defun mastodon-tl--cancel-scheduled-toot (no-confirm)
+(defun mastodon-tl--cancel-scheduled-toot (&optional id no-confirm)
"Cancel the scheduled toot at point.
-NO-CONFIRM means don't ask, just do."
+NO-CONFIRM means there is no ask or message, there is only do."
(interactive)
- (let* ((id (get-text-property (point) 'id))
+ (let* ((id (or id (get-text-property (point) 'id)))
(url (mastodon-http--api (format "scheduled_statuses/%s" id))))
(when (or no-confirm
(y-or-n-p "Cancel scheduled toot?"))
@@ -1925,7 +1925,8 @@ NO-CONFIRM means don't ask, just do."
(mastodon-http--triage response
(lambda ()
(mastodon-tl--view-scheduled-toots)
- (message "Toot cancelled!")))))))
+ (unless no-confirm
+ (message "Toot cancelled!"))))))))
(defun mastodon-tl--edit-scheduled-as-new ()
"Edit scheduled status as new toot."
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)))