aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-toot.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-01-28 13:42:40 +0100
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-01-28 13:42:40 +0100
commitad9f5a1cfd5332447d67012411790371b31f7c0b (patch)
treeb59819fb67e44a213fa0e7f3550c125a642fe2a9 /lisp/mastodon-toot.el
parent9992f16c77f596e5596c3bc437f118aa5c6a11e3 (diff)
list toot boosters and favers
Diffstat (limited to 'lisp/mastodon-toot.el')
-rw-r--r--lisp/mastodon-toot.el31
1 files changed, 31 insertions, 0 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index cc3d506..e233fba 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -423,6 +423,37 @@ TYPE is a symbol, either 'favourite or 'boost."
(message (format "%s #%s" message id)))))
(message (format "Nothing to %s here?!?" action)))))
+(defun mastodon-toot--list-toot-boosters ()
+ "List the boosters of toot at point."
+ (interactive)
+ (mastodon-toot--list-toot-boosters-or-favers))
+
+(defun mastodon-toot--list-toot-favouriters ()
+ "List the favouriters of toot at point."
+ (interactive)
+ (mastodon-toot--list-toot-boosters-or-favers :favourite))
+
+(defun mastodon-toot--list-toot-boosters-or-favers (&optional favourite)
+ "List the favouriters or boosters of toot at point.
+With FAVOURITE, list favouriters, else list boosters."
+ (let* ((base-toot (mastodon-tl--property 'base-toot-id))
+ (endpoint (if favourite "favourited_by" "reblogged_by"))
+ (url (mastodon-http--api
+ (format "statuses/%s/%s" base-toot endpoint)))
+ (params '(("limit" . "80")))
+ (json (mastodon-http--get-json url params))
+ (handles (mapcar (lambda (x) (alist-get 'acct x)) json))
+ (type-string (if favourite "Favouriters" "Boosters")))
+ (if (not handles)
+ (error "Looks like this toot has no %s" type-string)
+ (let ((choice
+ (completing-read
+ (format "%s (enter to view profile): " type-string)
+ handles
+ nil
+ t)))
+ (mastodon-profile--show-user choice)))))
+
(defun mastodon-toot--copy-toot-url ()
"Copy URL of toot at point.
If the toot is a fave/boost notification, copy the URLof the