[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ement 38009c5b56 1/2: Add: (ement-room-hide-redacted-me
From: |
ELPA Syncer |
Subject: |
[elpa] externals/ement 38009c5b56 1/2: Add: (ement-room-hide-redacted-message-content) New option |
Date: |
Thu, 10 Apr 2025 00:58:15 -0400 (EDT) |
branch: externals/ement
commit 38009c5b56fae970200a89bdfda3722ed4557a6e
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>
Add: (ement-room-hide-redacted-message-content) New option
---
README.org | 1 +
ement-room.el | 25 +++++++++++++++++++++++++
2 files changed, 26 insertions(+)
diff --git a/README.org b/README.org
index 3137d91ee6..c5570e3da9 100644
--- a/README.org
+++ b/README.org
@@ -302,6 +302,7 @@ Ement.el doesn't support encrypted rooms natively, but it
can be used transparen
*Additions*
+ Customization groups for faces. (Thanks to
[[https://github.com/phil-s][Phil Sainty]].)
++ Option ~ement-room-hide-redacted-message-content~, which hides the content
of redacted messages by default. It may be disabled to keep redacted content
visible with a strikethrough face, which may be useful for room moderators, but
users should keep in mind that doing so will leave unpleasant content visible
in the current session, even after being redacted by moderators.
*Changes*
diff --git a/ement-room.el b/ement-room.el
index 878e0df5c0..96697b43e6 100644
--- a/ement-room.el
+++ b/ement-room.el
@@ -336,6 +336,23 @@ If more than this many users have sent a reaction, show the
number of senders instead (and the names in a tooltip)."
:type 'natnum)
+(defcustom ement-room-hide-redacted-message-content t
+ "Hide content in redacted messages.
+If nil, redacted messages' content will remain visible with a
+strikethrough face until the session is terminated (a new session
+will not receive the redacted content).
+
+Disabling this option may be useful for room administrators and
+moderators, so they can see content redacted by other users and
+handle it appropriately. However, one should use this option
+with caution, as it will keep unpleasant content visible even
+after it has been redacted.
+
+After changing this option, a room's buffer must be killed and
+reopened for existing messages to be rendered accordingly."
+ :type '(choice (const :tag "Hide content" t)
+ (const :tag "Strikethrough" nil)))
+
;;;;; Faces
(defface ement-room-name
@@ -4164,6 +4181,14 @@ If FORMATTED-P, return the formatted body content, when
available."
(when (equal "m.replace" rel-type)
;; Message is an edit.
(setf body (concat body " " (propertize "[edited]" 'face
'font-lock-comment-face))))
+ (when (and (or local-redacted-by unsigned-redacted-by)
+ ement-room-hide-redacted-message-content)
+ ;; Message is redacted and hiding is enabled: override the body to hide
the content.
+ ;; (This is a bit of a hack, since we've already prepared the body at
this point,
+ ;; but retrofitting this into the existing logic is more than I want to
do right
+ ;; now. There are probably 3 or 4 different ways and places we could
handle
+ ;; redaction of content, and this seems like the simplest.)
+ (setf body "[redacted]"))
body))
(defun ement-room--render-html (string)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/ement 38009c5b56 1/2: Add: (ement-room-hide-redacted-message-content) New option,
ELPA Syncer <=