Add support for incoming REDACT

This does not include support for redacting messages, only reading
incoming REDACT messages.

See: https://github.com/ircv3/ircv3-specifications/pull/524
This commit is contained in:
delthas 2025-02-05 17:51:06 +01:00 committed by Simon Ser
parent ca0cfdcc28
commit 7dd21177bc
4 changed files with 21 additions and 4 deletions

View file

@ -94,7 +94,7 @@ function canFoldMessage(msg) {
class LogLine extends Component {
shouldComponentUpdate(nextProps) {
return this.props.message !== nextProps.message;
return this.props.message !== nextProps.message || this.props.redacted !== nextProps.redacted;
}
render() {
@ -143,13 +143,18 @@ class LogLine extends Component {
`;
}
} else {
lineClass = "talk";
let prefix = "<", suffix = ">";
if (msg.command === "NOTICE") {
lineClass += " notice";
prefix = suffix = "-";
}
content = html`<span class="nick-caret">${prefix}</span>${createNick(msg.prefix.name)}<span class="nick-caret">${suffix}</span> ${linkify(stripANSI(text), onChannelClick)}`;
if (this.props.redacted) {
content = html`<i>This message has been deleted.</i>`;
} else {
content = html`${linkify(stripANSI(text), onChannelClick)}`;
lineClass += " talk";
}
content = html`<span class="nick-caret">${prefix}</span>${createNick(msg.prefix.name)}<span class="nick-caret">${suffix}</span> ${content}`;
}
let allowedPrefixes = server.statusMsg;
@ -710,6 +715,7 @@ export default class Buffer extends Component {
message=${msg}
buffer=${buf}
server=${server}
redacted=${buf.redacted.has(msg.tags.msgid)}
onChannelClick=${onChannelClick}
onNickClick=${onNickClick}
onVerifyClick=${onVerifyClick}