aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-tl.el
diff options
context:
space:
mode:
authormousebot <mousebot@riseup.net>2022-02-07 16:54:54 +0100
committermousebot <mousebot@riseup.net>2022-02-07 16:58:12 +0100
commit4bd42aa4c52d709a512be94524fe1182eac9c4f6 (patch)
tree4b2ba033d489da28c2f74f215d328cc7edd29dc9 /lisp/mastodon-tl.el
parent7e21eeabc68102e4bae6c5729a69daf5b9e2aca4 (diff)
implement follow suggestions.
this factors out display of accounts from mastodon-search--search-query into mastodon-search--insert-users-propertized. mastodon-tl--get-follow-suggestions is the fun to view suggestions. seeing as this allows easy display of profile note under the account handle, i also added this display to --search-query, but it cd be easily disabled by calling --insert-users-propertized without its second arg.
Diffstat (limited to 'lisp/mastodon-tl.el')
-rw-r--r--lisp/mastodon-tl.el20
1 files changed, 20 insertions, 0 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index d3ab56b..13c6729 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -60,6 +60,7 @@
;; make notifications--get available via M-x and outside our keymap:
(autoload 'mastodon-notifications--get "mastodon-notifications"
"Display NOTIFICATIONS in buffer." t) ; interactive
+(autoload 'mastodon-search--insert-users-propertized "mastodon-search")
(defvar mastodon-instance-url)
(defvar mastodon-toot-timestamp-format)
(defvar shr-use-fonts) ;; declare it since Emacs24 didn't have this
@@ -991,6 +992,25 @@ webapp"
(alist-get 'descendants context)))))
(message "No Thread!"))))
+(defun mastodon-tl--get-follow-suggestions ()
+"Display a buffer of suggested accounts to follow."
+ (interactive)
+ (let* ((buffer (format "*mastodon-follow-suggestions*"))
+ (response
+ (mastodon-http--get-json
+ (mastodon-http--api "suggestions")))
+ (users (mapcar 'mastodon-search--get-user-info response)))
+ (with-output-to-temp-buffer buffer
+ (let ((inhibit-read-only t))
+ (switch-to-buffer buffer)
+ (mastodon-mode)
+ (insert (mastodon-tl--set-face
+ (concat "\n ------------\n"
+ " SUGGESTED ACCOUNTS\n"
+ " ------------\n\n")
+ 'success))
+ (mastodon-search--insert-users-propertized users :note)))))
+
(defun mastodon-tl--follow-user (user-handle &optional notify)
"Query for USER-HANDLE from current status and follow that user.
If NOTIFY is \"true\", enable notifications when that user posts.