diff options
author | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-03-20 20:55:13 +0100 |
---|---|---|
committer | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-03-20 20:55:13 +0100 |
commit | 751e0d3fb8c0edcccfdd7ecc78025f03d513d03c (patch) | |
tree | f07d77cf7422982c702de9091cf1390dd85a45d5 /lisp | |
parent | 4c90d4700a18ed9b980805ef637b8f3d31a8add5 (diff) |
factor out map-account-id-from-toot
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/mastodon-tl.el | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index a6e3087..b20e889 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1705,6 +1705,14 @@ If UNMUTE, unmute it." (message "Thread unmuted!") (message "Thread muted!"))))))))))) + +(defun mastodon-tl--map-account-id-from-toot (statuses) + "Return a list of the account IDs of the author of each toot in STATUSES." + (mapcar (lambda (status) + (alist-get 'id + (alist-get 'account status))) + statuses)) + (defun mastodon-tl--user-in-thread-p (id) "Return non-nil if the logged-in user has posted to the current thread. ID is that of the post the context is currently displayed for." @@ -1713,14 +1721,8 @@ ID is that of the post the context is currently displayed for." nil :silent)) (ancestors (alist-get 'ancestors context-json)) (descendants (alist-get 'descendants context-json)) - (a-ids (mapcar (lambda (status) - (alist-get 'id - (alist-get 'account status))) - ancestors)) - (d-ids (mapcar (lambda (status) - (alist-get 'id - (alist-get 'account status))) - descendants))) + (a-ids (mastodon-tl--map-account-id-from-toot a-ids ancestors)) + (d-ids (mastodon-tl--map-account-id-from-toot a-ids descendants))) (or (member (mastodon-auth--get-account-id) a-ids) (member (mastodon-auth--get-account-id) d-ids)))) |