aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-profile.el
diff options
context:
space:
mode:
authormousebot <mousebot@riseup.net>2022-02-19 13:43:24 +0100
committermousebot <mousebot@riseup.net>2022-02-19 13:46:16 +0100
commit13e1ebff3b73ba3e6ad522d91103f432ce96ff92 (patch)
tree0eb05843e8dc53132c65b1fe6fd13523913859d0 /lisp/mastodon-profile.el
parent34440b68ff6d3430428372d2968adc55ea9c6f03 (diff)
add checks to profile--show-user for when its called on nothing
- also make profile--extract-ysers-handles work on user listings as well as toots
Diffstat (limited to 'lisp/mastodon-profile.el')
-rw-r--r--lisp/mastodon-profile.el38
1 files changed, 22 insertions, 16 deletions
diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el
index 57fa080..9c1cd88 100644
--- a/lisp/mastodon-profile.el
+++ b/lisp/mastodon-profile.el
@@ -400,19 +400,23 @@ If toot is a boost, opens the profile of the booster."
"Query for USER-HANDLE from current status and show that user's profile."
(interactive
(list
- (let ((user-handles (mastodon-profile--extract-users-handles
- (mastodon-profile--toot-json))))
- (completing-read "View profile of user [choose or enter any handle]: "
- user-handles
- nil ; predicate
- 'confirm))))
- (let ((account (mastodon-profile--lookup-account-in-status
- user-handle (mastodon-profile--toot-json))))
- (if account
- (progn
- (message "Loading profile of user %s..." user-handle)
- (mastodon-profile--make-author-buffer account))
- (message "Cannot find a user with handle %S" user-handle))))
+ (if (not (get-text-property (point) 'toot-json))
+ (message "Looks like there's no toot or user at point?")
+ (let ((user-handles (mastodon-profile--extract-users-handles
+ (mastodon-profile--toot-json))))
+ (completing-read "View profile of user [choose or enter any handle]: "
+ user-handles
+ nil ; predicate
+ 'confirm)))))
+ (if (not (get-text-property (point) 'toot-json))
+ (message "Looks like there's no toot or user at point?")
+ (let ((account (mastodon-profile--lookup-account-in-status
+ user-handle (mastodon-profile--toot-json))))
+ (if account
+ (progn
+ (message "Loading profile of user %s..." user-handle)
+ (mastodon-profile--make-author-buffer account))
+ (message "Cannot find a user with handle %S" user-handle)))))
(defun mastodon-profile--my-profile ()
"Show the profile of the currently signed in user."
@@ -474,9 +478,11 @@ If the handle does not match a search return then retun NIL."
These include the author, author of reblogged entries and any user mentioned."
(when status
- (let ((this-account (alist-get 'account status))
- (mentions (alist-get 'mentions status))
- (reblog (alist-get 'reblog status)))
+ (let ((this-account
+ (or (alist-get 'account status) ; status is a toot
+ status)) ; status is a user listing
+ (mentions (alist-get 'mentions status))
+ (reblog (alist-get 'reblog status)))
(seq-filter
'stringp
(seq-uniq