branch: elpa/mastodon
commit 68712fd2aa8094192dc368c11257df512e8eacd5
Author: marty hiatt <[email protected]>
Commit: marty hiatt <[email protected]>

    with-toot-item macro for delete-toot. FIX #730.
---
 lisp/mastodon-toot.el | 39 ++++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index 9a9a7870cb..17df843b47 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -680,25 +680,26 @@ NO-REDRAFT means delete toot only."
          (id (mastodon-tl--as-string (mastodon-tl--item-id toot)))
          (url (mastodon-http--api (format "statuses/%s" id)))
          (pos (point)))
-    (let-alist toot
-      (if (not (mastodon-toot--own-toot-p toot))
-          (user-error "You can only delete (and redraft) your own toots")
-        (when (y-or-n-p (if no-redraft
-                            (format "Delete this toot? ")
-                          (format "Delete and redraft this toot? ")))
-          (let* ((response (mastodon-http--delete url)))
-            (mastodon-http--triage
-             response
-             (lambda (_)
-               (if no-redraft
-                   (progn
-                     (when mastodon-tl--buffer-spec
-                       (mastodon-tl--reload-timeline-or-profile pos))
-                     (message "Toot deleted!"))
-                 (mastodon-toot--redraft response
-                                         .in_reply_to_id
-                                         .visibility
-                                         .spoiler_text))))))))))
+    (mastodon-toot--with-toot-item
+     (let-alist toot
+       (if (not (mastodon-toot--own-toot-p toot))
+           (user-error "You can only delete (and redraft) your own toots")
+         (when (y-or-n-p (if no-redraft
+                             (format "Delete this toot? ")
+                           (format "Delete and redraft this toot? ")))
+           (let* ((response (mastodon-http--delete url)))
+             (mastodon-http--triage
+              response
+              (lambda (_)
+                (if no-redraft
+                    (progn
+                      (when mastodon-tl--buffer-spec
+                        (mastodon-tl--reload-timeline-or-profile pos))
+                      (message "Toot deleted!"))
+                  (mastodon-toot--redraft response
+                                          .in_reply_to_id
+                                          .visibility
+                                          .spoiler_text)))))))))))
 
 (defun mastodon-toot--set-cw (&optional cw)
   "Set content warning to CW if it is non-nil."

Reply via email to