diff options
author | mousebot <mousebot@riseup.net> | 2021-05-07 13:30:29 +0200 |
---|---|---|
committer | mousebot <mousebot@riseup.net> | 2021-05-07 13:30:29 +0200 |
commit | 3a89ca3212803f3104212b6219448e533aac3ab2 (patch) | |
tree | cfde247dfc92dc71bdb4d1e515f41d5079bebfba | |
parent | 2c4f627c2a22b8105cb3f5ffba429549d4f8e6e7 (diff) |
follow user or booster of toot at point fun
-rw-r--r-- | lisp/mastodon-tl.el | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index bb92378..d271243 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -42,6 +42,9 @@ (autoload 'mastodon-profile--account-from-id "mastodon.el-profile.el") (autoload 'mastodon-profile--make-author-buffer "mastodon-profile.el") (autoload 'mastodon-profile--search-account-by-handle "mastodon.el-profile.el") +;; try an autoload for new follow fun +(autoload 'mastodon-profile--toot-json "mastodon-profile.el") +(autoload 'mastodon-profile--account-field "mastodon-profile.el") (defvar mastodon-instance-url) (defvar mastodon-toot-timestamp-format) (defvar shr-use-fonts) ;; need to declare it since Emacs24 didn't have this @@ -795,6 +798,20 @@ webapp" (lambda () (message "Toot deleted! There may be a delay before it disappears from your profile.")))))) +;; follow user at point: +;; try to make it work only for toot user id first, then try to allow mentions/boosts +(defun mastodon-tl--follow-user () + "Follow author OR BOOSTER! of toot at point synchronously." + (interactive) + (let* ((account + (cdr (assoc 'account (mastodon-profile--toot-json)))) ; acc data from toot + (user-id (mastodon-profile--account-field account 'id)) ; id from acc + (url (mastodon-http--api (format "accounts/%s/follow" user-id)))) + (let ((response (mastodon-http--post url nil nil))) + (mastodon-http--triage response + (lambda () + (message "User ID %s followed!" user-id)))))) ; TODO: use handle + (defun mastodon-tl--more () "Append older toots to timeline." (interactive) |