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:46:12 +0200
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-08-31 16:46:12 +0200
commita30b8353d122a753be6fcf38fe84f7da99ad2ebd (patch)
treece73466d2bc798bd5fc32257894b06f6ef14d8e8 /lisp/mastodon-profile.el
parent6fe9d764d568c2ba001a932305f5d926c2f63c25 (diff)
refactor locked toggle, add discoverable toggle
Diffstat (limited to 'lisp/mastodon-profile.el')
-rw-r--r--lisp/mastodon-profile.el23
1 files changed, 17 insertions, 6 deletions
diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el
index 284bae6..5c4adaa 100644
--- a/lisp/mastodon-profile.el
+++ b/lisp/mastodon-profile.el
@@ -273,12 +273,23 @@ SOURCE means that the preference is in the 'source' part of the account json."
"Toggle the locked status of the user's account.
Locked accounts mean follow requests have to be manually approved."
(interactive)
- (let ((locked-p (mastodon-profile--get-json-value 'locked)))
- (if (not (equal locked-p :json-false))
- (when (y-or-n-p "Account is locked to new followers. Unlock?")
- (mastodon-profile--update-preference "locked" "false"))
- (when (y-or-n-p "Account is not locked to new followers. Lock it?")
- (mastodon-profile--update-preference "locked" "true")))))
+ (mastodon-profile--toggle-account-key 'locked))
+
+(defun mastodon-profile-account-discoverable-toggle ()
+ "Toggle the discoverable status of the user's account.
+Discoverable means the account is listed in the server directory."
+ (interactive)
+ (mastodon-profile--toggle-account-key 'discoverable))
+
+(defun mastodon-profile--toggle-account-key (key)
+ "Toggle the boolean account setting KEY."
+ (let* ((val (mastodon-profile--get-json-value key))
+ (prompt (format "Account setting %s is %s. Toggle?" key val)))
+ (if (not (equal val :json-false))
+ (when (y-or-n-p prompt)
+ (mastodon-profile--update-preference (symbol-name key) "false"))
+ (when (y-or-n-p prompt)
+ (mastodon-profile--update-preference (symbol-name key) "true")))))
(defun mastodon-profile-set-default-toot-visibility ()
"Set the default visibility for toots."