aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.org3
-rw-r--r--lisp/mastodon-toot.el24
2 files changed, 26 insertions, 1 deletions
diff --git a/README.org b/README.org
index 85ff179..35ebb99 100644
--- a/README.org
+++ b/README.org
@@ -263,6 +263,9 @@ work without first loading =mastodon.el=:
- =mastodon-profile--account-sensitive-toggle=: Toggle whether your posts are
marked as sensitive (nsfw) by default.
+- =mastodon-toot--default-reply-visibility=: Set the default visibility for replies.
+ This visibility is used only when the original post has less restrictive visibility.
+
*** Customization
See =M-x customize-group RET mastodon= to view all customize options.
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index c18f751..9e8a2cc 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -140,6 +140,16 @@ You need to install company yourself to use this."
:group 'mastodon-toot
:type 'integer)
+(defcustom mastodon-toot--default-reply-visibility "public"
+ "Default visibility settings when replying.
+If the original toot visibility is different we use the more restricted one."
+ :group 'mastodon-toot
+ :type '(choice
+ (const :tag "public" "public")
+ (const :tag "unlisted" "unlisted")
+ (const :tag "followers only" "private")
+ (const :tag "direct" "direct")))
+
(defcustom mastodon-toot--enable-custom-instance-emoji nil
"Whether to enable your instance's custom emoji by default."
:group 'mastodon-toot
@@ -1348,11 +1358,23 @@ REPLY-TEXT is the text of the toot being replied to."
'read-only "Edit your message below."
'toot-post-header t))))
+(defun mastodon-toot--most-restrictive-visibility (reply-visibility)
+ "Return REPLY-VISIBILITY or default visibility, whichever is more restrictive.
+The default is given by `mastodon-toot--default-reply-visibility'."
+ (unless (null reply-visibility)
+ (let ((less-restrictive (member (intern mastodon-toot--default-reply-visibility)
+ mastodon-toot-visibility-list)))
+ (insert (format "%s" reply-visibility))
+ (if (member (intern reply-visibility) less-restrictive)
+ mastodon-toot--default-reply-visibility reply-visibility))))
+
(defun mastodon-toot--setup-as-reply (reply-to-user reply-to-id reply-json)
"If REPLY-TO-USER is provided, inject their handle into the message.
If REPLY-TO-ID is provided, set `mastodon-toot--reply-to-id'.
REPLY-JSON is the full JSON of the toot being replied to."
- (let ((reply-visibility (alist-get 'visibility reply-json))
+ (let ((reply-visibility
+ (mastodon-toot--most-restrictive-visibility
+ (alist-get 'visibility reply-json)))
(reply-cw (alist-get 'spoiler_text reply-json)))
(when reply-to-user
(insert (format "%s " reply-to-user))