diff options
author | marty hiatt <martianhiatus@riseup.net> | 2023-10-24 14:10:07 +0200 |
---|---|---|
committer | marty hiatt <martianhiatus@riseup.net> | 2023-10-24 14:10:07 +0200 |
commit | c3db1170e80c90563ccfee76b6d12502f4d53f2a (patch) | |
tree | 95295dbe7f9df9c7896be8b7885e200a6e7aa2e6 /lisp | |
parent | f7ec0268e0fcf4d9f6f80ae3d246d878d9350cc8 (diff) |
edit toot at point: do-if-item-strict
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/mastodon-toot.el | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 3f20a14..682f6ca 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." |