From ef0db16833485400704c1b65d5a4e464256a94b7 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Tue, 22 Aug 2023 18:20:30 +0200 Subject: new fun: mastodon-return-credential-account, var: mastodon-profile-credential-account FIX #480. --- lisp/mastodon-profile.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'lisp/mastodon-profile.el') diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index bbd286e..de235b3 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -105,6 +105,10 @@ extra keybindings." :group 'mastodon :global nil) +(defvar mastodon-profile-credential-account nil + "Holds the JSON data of the CredentialAccount entity, + containing details of the current user's account.") + (defvar mastodon-profile-update-mode-map (let ((map (make-sparse-keymap))) (define-key map (kbd "C-c C-c") #'mastodon-profile--user-profile-send-updated) @@ -212,8 +216,7 @@ NO-REBLOGS means do not display boosts in statuses." (defun mastodon-profile--get-json-value (val) "Fetch current VAL ue from account." - (let* ((url (mastodon-http--api "accounts/verify_credentials")) - (response (mastodon-http--get-json url))) + (let* ((response (mastodon-return-credential-account))) (if (eq (alist-get val response) :json-false) nil (alist-get val response)))) @@ -232,9 +235,7 @@ NO-REBLOGS means do not display boosts in statuses." (defun mastodon-profile--update-user-profile-note () "Fetch user's profile note and display for editing." (interactive) - (let* ((endpoint "accounts/verify_credentials") - (url (mastodon-http--api endpoint)) - (json (mastodon-http--get-json url)) + (let* ((json (mastodon-return-credential-account)) (source (alist-get 'source json)) (note (alist-get 'note source)) (buffer (get-buffer-create "*mastodon-update-profile*")) -- cgit v1.2.3