aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-08-22 18:20:30 +0200
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-08-22 18:39:46 +0200
commitef0db16833485400704c1b65d5a4e464256a94b7 (patch)
treed670f6b9ebe1a7d5df8f67176290e3b2c23e6055 /lisp/mastodon.el
parent38d6382a1f8bc50c76f77a407ae5db4ff0d75156 (diff)
new fun: mastodon-return-credential-account, var: mastodon-profile-credential-account
FIX #480.
Diffstat (limited to 'lisp/mastodon.el')
-rw-r--r--lisp/mastodon.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/lisp/mastodon.el b/lisp/mastodon.el
index 84d3d1d..a3b372d 100644
--- a/lisp/mastodon.el
+++ b/lisp/mastodon.el
@@ -281,6 +281,7 @@ See `mastodon-toot-display-orig-in-reply-buffer'.")
(string-prefix-p "*mastodon-" (buffer-name x))
(get-buffer x)))
(buffer-list))))) ; catch any other masto buffer
+ (mastodon-return-credential-account)
(if buffer
(switch-to-buffer buffer)
(mastodon-tl--get-home-timeline)
@@ -288,6 +289,17 @@ See `mastodon-toot-display-orig-in-reply-buffer'.")
(mastodon-auth--user-acct)
mastodon-instance-url))))
+(defvar mastodon-profile-credential-account nil)
+
+(defun mastodon-return-credential-account ()
+ "Return the CredentialAccount entity.
+Either from `mastodon-profile-credential-account' or from the server."
+ (or mastodon-profile-credential-account
+ (setq mastodon-profile-credential-account
+ (mastodon-http--get-json
+ (mastodon-http--api "accounts/verify_credentials")
+ nil :silent))))
+
;;;###autoload
(defun mastodon-toot (&optional user reply-to-id reply-json)
"Update instance with new toot. Content is captured in a new buffer.