emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/mastodon c3db1170e8 33/52: edit toot at point: do-if-item-


From: ELPA Syncer
Subject: [nongnu] elpa/mastodon c3db1170e8 33/52: edit toot at point: do-if-item-strict
Date: Mon, 30 Oct 2023 16:01:26 -0400 (EDT)

branch: elpa/mastodon
commit c3db1170e80c90563ccfee76b6d12502f4d53f2a
Author: marty hiatt <martianhiatus@riseup.net>
Commit: marty hiatt <martianhiatus@riseup.net>

    edit toot at point: do-if-item-strict
---
 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 3f20a145f9..682f6ca642 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -876,25 +876,26 @@ instance to edit a toot."
 (defun mastodon-toot--edit-toot-at-point ()
   "Edit the user's toot at point."
   (interactive)
-  (let ((toot (or (mastodon-tl--property 'base-toot) ; fave/boost notifs
-                  (mastodon-tl--property 'item-json))))
-    (if (not (mastodon-toot--own-toot-p toot))
-        (message "You can only edit your own toots.")
-      (let* ((id (mastodon-tl--as-string (mastodon-tl--item-id toot)))
-             (source (mastodon-toot--get-toot-source id))
-             (content (alist-get 'text source))
-             (source-cw (alist-get 'spoiler_text source))
-             (toot-visibility (alist-get 'visibility toot))
-             (toot-language (alist-get 'language toot))
-             (reply-id (alist-get 'in_reply_to_id toot)))
-        (when (y-or-n-p "Edit this toot? ")
-          (mastodon-toot--compose-buffer nil reply-id nil content :edit)
-          (goto-char (point-max))
-          ;; adopt reply-to-id, visibility, CW, and language:
-          (mastodon-toot--set-toot-properties reply-id toot-visibility
-                                              source-cw toot-language)
-          (mastodon-toot--update-status-fields)
-          (setq mastodon-toot--edit-item-id id))))))
+  (mastodon-tl--do-if-item-strict
+   (let ((toot (or (mastodon-tl--property 'base-toot) ; fave/boost notifs
+                   (mastodon-tl--property 'item-json))))
+     (if (not (mastodon-toot--own-toot-p toot))
+         (message "You can only edit your own toots.")
+       (let* ((id (mastodon-tl--as-string (mastodon-tl--item-id toot)))
+              (source (mastodon-toot--get-toot-source id))
+              (content (alist-get 'text source))
+              (source-cw (alist-get 'spoiler_text source))
+              (toot-visibility (alist-get 'visibility toot))
+              (toot-language (alist-get 'language toot))
+              (reply-id (alist-get 'in_reply_to_id toot)))
+         (when (y-or-n-p "Edit this toot? ")
+           (mastodon-toot--compose-buffer nil reply-id nil content :edit)
+           (goto-char (point-max))
+           ;; adopt reply-to-id, visibility, CW, and language:
+           (mastodon-toot--set-toot-properties reply-id toot-visibility
+                                               source-cw toot-language)
+           (mastodon-toot--update-status-fields)
+           (setq mastodon-toot--edit-item-id id)))))))
 
 (defun mastodon-toot--get-toot-source (id)
   "Fetch the source JSON of toot with ID."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]