aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mastodon-tl.el11
-rw-r--r--lisp/mastodon-toot.el6
2 files changed, 11 insertions, 6 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 61c612a..6e80db3 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -1504,6 +1504,13 @@ timeline."
;;; UTILITIES
+;; consider having this return an id / acct alist
+(defun mastodon-tl--map-get-accts (alist)
+ "Return a list of handles from ALIST."
+ (mapcar (lambda (x)
+ (alist-get 'acct x))
+ alist))
+
(defun mastodon-tl--symbol (name)
"Return the unicode symbol (as a string) corresponding to NAME.
If symbol is not displayable, an ASCII equivalent is returned. If
@@ -1872,9 +1879,7 @@ Action must be either \"unblock\" or \"unmute\"."
"mutes")))
(url (mastodon-http--api endpoint))
(json (mastodon-http--get-json url))
- (accts (mapcar (lambda (user)
- (alist-get 'acct user))
- json)))
+ (accts (mastodon-tl--map-get-accts json)))
(when accts
(completing-read (format "Handle of user to %s: " action)
accts
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index 87b4afb..1d91f84 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -75,6 +75,7 @@
(autoload 'mastodon-tl--find-property-range "mastodon-tl")
(autoload 'mastodon-tl--find-property-range "mastodon-tl")
(autoload 'mastodon-tl--goto-next-toot "mastodon-tl")
+(autoload 'mastodon-tl--map-get-accts "mastodon-views")
(autoload 'mastodon-tl--property "mastodon-tl")
(autoload 'mastodon-tl--reload-timeline-or-profile "mastodon-tl")
(autoload 'mastodon-tl--render-text "mastodon-tl")
@@ -450,7 +451,7 @@ With FAVOURITE, list favouriters, else list boosters."
(if (eq (caar json) 'error)
(error "%s (Status does not exist or is private)"
(alist-get 'error json))
- (let ((handles (mapcar (lambda (x) (alist-get 'acct x)) json))
+ (let ((handles (mastodon-tl--map-get-accts json))
(type-string (if favourite "Favouriters" "Boosters")))
(if (not handles)
(error "Looks like this toot has no %s" type-string)
@@ -920,8 +921,7 @@ Federated user: `username@host.co`."
(alist-get 'mentions (alist-get 'reblog status))
(alist-get 'mentions status))))
;; reverse does not work on vectors in 24.5
- (mapcar (lambda(x) (alist-get 'acct x))
- (reverse mentions))))
+ (mastodon-tl--map-get-accts (reverse mentions))))
(defun mastodon-toot--get-bounds (regex)
"Get bounds of tag or handle before point using REGEX."