aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-profile.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-08-31 16:32:26 +0200
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-08-31 16:32:26 +0200
commit4d9073299485d3dc6095f824ae017b7d35bd0c1d (patch)
treef3eec596aab2d3f758e9c26b6f4131e5a83b5f5d /lisp/mastodon-profile.el
parent889e7079efe2ea266491dc383491a8a3dfb6ca94 (diff)
profile: refactor get-source-prefs with get-json-value
Diffstat (limited to 'lisp/mastodon-profile.el')
-rw-r--r--lisp/mastodon-profile.el10
1 files changed, 7 insertions, 3 deletions
diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el
index 0c91556..1fc4d09 100644
--- a/lisp/mastodon-profile.el
+++ b/lisp/mastodon-profile.el
@@ -212,11 +212,15 @@ JSON is the data returned by the server."
;;; account preferences
-(defun mastodon-profile--get-source-prefs ()
- "Return the \"source\" preferences from the server."
+(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)))
- (alist-get 'source response)))
+ (alist-get val response)))
+
+(defun mastodon-profile--get-source-prefs ()
+ "Return the \"source\" preferences from the server."
+ (mastodon-profile--get-json-value 'source))
(defun mastodon-profile--get-source-pref (pref)
"Return account PREF erence from the \"source\" section on the server."