aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-08-31 16:32:50 +0200
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-08-31 16:32:50 +0200
commit6fe9d764d568c2ba001a932305f5d926c2f63c25 (patch)
tree961e52116e0b31038693d28dace8cd9f2aeb79da
parent4d9073299485d3dc6095f824ae017b7d35bd0c1d (diff)
toggle account locked status
-rw-r--r--lisp/mastodon-profile.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el
index 1fc4d09..284bae6 100644
--- a/lisp/mastodon-profile.el
+++ b/lisp/mastodon-profile.el
@@ -260,6 +260,7 @@ JSON is the data returned by the server."
(defun mastodon-profile--update-preference (pref val &optional source)
"Update a single acount PREF erence to setting VAL.
+Both args are strings.
SOURCE means that the preference is in the 'source' part of the account json."
(let* ((url (mastodon-http--api "accounts/update_credentials"))
(pref (if source (concat "source[" pref "]") pref))
@@ -268,6 +269,17 @@ SOURCE means that the preference is in the 'source' part of the account json."
(lambda ()
(message "Account setting %s updated!" pref)))))
+(defun mastodon-profile-account-locked-toggle ()
+ "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")))))
+
(defun mastodon-profile-set-default-toot-visibility ()
"Set the default visibility for toots."
(interactive)