diff options
author | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2022-10-31 11:35:00 +0100 |
---|---|---|
committer | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2022-11-05 15:41:27 +0100 |
commit | 0f85f3d69066a48434a6b27c4cbb77aa976984e9 (patch) | |
tree | f4e1b8aee5e4ee0bef0427cae8f22bee5c863cd8 /lisp/mastodon-profile.el | |
parent | 42990b2a471afc2d4cc1102f8cec8e70982f2e2c (diff) |
convert :json-false to nil in account settings handling
:json-false isn't nil, so doesn't work as we want
Diffstat (limited to 'lisp/mastodon-profile.el')
-rw-r--r-- | lisp/mastodon-profile.el | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index c6aa5e2..55e7d42 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -228,7 +228,9 @@ JSON is the data returned by the server." "Fetch current VAL ue from account." (let* ((url (mastodon-http--api "accounts/verify_credentials")) (response (mastodon-http--get-json url))) - (alist-get val response))) + (if (eq (alist-get val response) ':json-false) + nil + (alist-get val response)))) (defun mastodon-profile--get-source-values () "Return the \"source\" preferences from the server." @@ -237,7 +239,9 @@ JSON is the data returned by the server." (defun mastodon-profile--get-source-value (pref) "Return account PREF erence from the \"source\" section on the server." (let ((source (mastodon-profile--get-source-values))) - (alist-get pref source))) + (if (eq (alist-get pref source) ':json-false) + nil + (alist-get pref source)))) (defun mastodon-profile--update-user-profile-note () "Fetch user's profile note and display for editing." @@ -349,7 +353,7 @@ Current settings are fetched from the server." (mastodon-profile--get-source-value key) (mastodon-profile--get-json-value key))) (prompt (format "Account setting %s is %s. Toggle?" key val))) - (if (not (equal val :json-false)) + (if val (when (y-or-n-p prompt) (mastodon-profile--update-preference (symbol-name key) "false" source)) (when (y-or-n-p prompt) |