branch: elpa/mastodon
commit 10257d59d80ded6cbefe2d33c2db89734e5ca1fe
Author: marty hiatt <[email protected]>
Commit: marty hiatt <[email protected]>
set quote-policy as user preference. #756
---
lisp/mastodon-profile.el | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el
index 8c947334cd..d744963431 100644
--- a/lisp/mastodon-profile.el
+++ b/lisp/mastodon-profile.el
@@ -572,6 +572,24 @@ The endpoint only holds a few preferences. For others, see
"\n\n"))
(goto-char (point-min)))))
+(defvar mastodon-profiles-quote-policy-types
+ '(public followers nobody))
+
+(defun mastodon-profile-set-quote-policy ()
+ "Prompt for a quote policy and set it in the user's preferences."
+ (interactive)
+ (let* ((prefs
+ ;; this fetches from a local var, we want to fetch from server,
+ ;; else we need this var to update when we change this setting:
+ ;; (mastodon-profile--get-source-values))
+ ;; so we fetch from preferences instead:
+ (mastodon-http--get-json (mastodon-http--api "preferences")))
+ (current (alist-get 'posting:default:quote_policy prefs))
+ (choice (completing-read
+ (format "Set default quote policy [current: %s]: " current)
+ mastodon-profiles-quote-policy-types nil :match)))
+ (mastodon-profile--update-preference "quote_policy" choice 'source)))
+
;;; PROFILE VIEW DETAILS