diff options
author | mousebot <mousebot@riseup.net> | 2022-02-15 21:55:10 +0100 |
---|---|---|
committer | mousebot <mousebot@riseup.net> | 2022-02-17 09:50:03 +0100 |
commit | 1c0328ced821b152e3da911592a6acd12d8598dd (patch) | |
tree | 97750344e739748fddef44184ade8b4adfcceadb /lisp/mastodon-tl.el | |
parent | f545d8c1d65e3e2256f8b769bfdb87a5b6a1e3ea (diff) |
re-factor follow-user functions for various views
- revert profile--extract-users-handles
- rewrite search--insert-users-propertized to handle raw account JSON, and to
call search--get-user-info itself, so we can add full acct JSON to each user
displayed and use it for follow-user etc.
- and to choose how we want to follow users, we edit
tl--interactive-user-handles-get to work differently depending on context:
- poss contexts are "follow suggestions" view, search results, and profiles
displaying a user's followers/followed users.
Diffstat (limited to 'lisp/mastodon-tl.el')
-rw-r--r-- | lisp/mastodon-tl.el | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index ec9c033..6bb5656 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1253,7 +1253,7 @@ RESPONSE is the JSON returned by the server." " SUGGESTED ACCOUNTS\n" " ------------\n\n") 'success)) - (mastodon-search--insert-users-propertized users :note) + (mastodon-search--insert-users-propertized response :note) (goto-char (point-min)))) (defun mastodon-tl--follow-user (user-handle &optional notify) @@ -1321,8 +1321,17 @@ Can be called to toggle NOTIFY on users already being followed." (defun mastodon-tl--interactive-user-handles-get (action) "Get the list of user-handles for ACTION from the current toot." - (let ((user-handles (mastodon-profile--extract-users-handles - (mastodon-profile--toot-json)))) + (let ((user-handles + ;; follow suggests / search compat: + (cond ((or (equal (buffer-name) "*mastodon-follow-suggestions*") + (string-prefix-p "*mastodon-search" (buffer-name))) + (list (alist-get 'acct (mastodon-tl--property 'user-json)))) + ;; profile view follows/followers compat: + ((string-prefix-p "accounts" (mastodon-tl--get-endpoint)) + (list (alist-get 'acct (mastodon-tl--property 'toot-json)))) + (t + (mastodon-profile--extract-users-handles + (mastodon-profile--toot-json)))))) (completing-read (if (or (equal action "disable") (equal action "enable")) (format "%s notifications when user posts: " action) |