From 4d9073299485d3dc6095f824ae017b7d35bd0c1d Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Wed, 31 Aug 2022 16:32:26 +0200 Subject: profile: refactor get-source-prefs with get-json-value --- lisp/mastodon-profile.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lisp/mastodon-profile.el') 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." -- cgit v1.2.3