diff options
author | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-08-22 18:47:37 +0200 |
---|---|---|
committer | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-08-22 18:47:37 +0200 |
commit | a8ff368a246c554fc14f0387cee639f19563a3ca (patch) | |
tree | 5ae4338cb5517bb3e284f6d6b62363d3ea02be71 | |
parent | ef0db16833485400704c1b65d5a4e464256a94b7 (diff) |
new var: mastodon-profile-acccount-preferences-data, to reduce requests
-rw-r--r-- | lisp/mastodon-profile.el | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index de235b3..a89946c 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -109,6 +109,9 @@ extra keybindings." "Holds the JSON data of the CredentialAccount entity, containing details of the current user's account.") +(defvar mastodon-profile-acccount-preferences-data nil + "Holds the JSON data of the current user's preferences.") + (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) @@ -462,12 +465,16 @@ Returns the results as an alist." ;; used in tl.el (defun mastodon-profile--get-preferences-pref (pref) "Fetch PREF from the endpoint \"/preferences\". -This endpoint only holds a few preferences. For others, see +If `mastodon-profile-acccount-preferences-data' is set, fetch +from that instead. +The endpoint only holds a few preferences. For others, see `mastodon-profile--update-preference' and its endpoint, \"/accounts/update_credentials.\"" (alist-get pref - (mastodon-http--get-json - (mastodon-http--api "preferences")))) + (or mastodon-profile-acccount-preferences-data + (setq mastodon-profile-acccount-preferences-data + (mastodon-http--get-json + (mastodon-http--api "preferences")))))) (defun mastodon-profile--view-preferences () "View user preferences in another window." |