branch: elpa/mastodon
commit b9227d8c598e33c8321f991ab0d77960d9f51f46
Author: marty hiatt <[email protected]>
Commit: marty hiatt <[email protected]>
handle delete_media param for delete toot (when no redraft). #774.
---
lisp/mastodon-toot.el | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index 34bdccb5c1..1f3ee71502 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -681,14 +681,20 @@ NO-REDRAFT means delete toot only."
(mastodon-toot--with-toot-item
(let* ((toot (mastodon-toot--base-toot-or-item-json))
(url (mastodon-http--api (format "statuses/%s" id)))
+ (attachmentsp (mastodon-tl--field 'media_attachments toot))
(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)))
+ "Delete this toot? "
+ "Delete and redraft this toot? "))
+ (let* ((params
+ (when (and attachmentsp
+ no-redraft
+ (y-or-n-p "Also delete toot's attachments?"))
+ `(("delete_media" . "true"))))
+ (response (mastodon-http--delete url params)))
(mastodon-http--triage
response
(lambda (_)