forked from CringeStudios/gamja
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:
parent
ca0cfdcc28
commit
7dd21177bc
@ -762,7 +762,7 @@ export default class App extends Component {
|
|||||||
|
|
||||||
// Open a new buffer if the message doesn't come from me or is a
|
// Open a new buffer if the message doesn't come from me or is a
|
||||||
// self-message
|
// self-message
|
||||||
if ((!client.isMyNick(msg.prefix.name) || client.isMyNick(bufName)) && (msg.command !== "PART" && msg.comand !== "QUIT" && msg.command !== irc.RPL_MONONLINE && msg.command !== irc.RPL_MONOFFLINE)) {
|
if ((!client.isMyNick(msg.prefix.name) || client.isMyNick(bufName)) && (msg.command !== "PART" && msg.command !== "QUIT" && msg.command !== irc.RPL_MONONLINE && msg.command !== irc.RPL_MONOFFLINE)) {
|
||||||
this.createBuffer(serverID, bufName);
|
this.createBuffer(serverID, bufName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1075,6 +1075,7 @@ export default class App extends Component {
|
|||||||
case "ACK":
|
case "ACK":
|
||||||
case "BOUNCER":
|
case "BOUNCER":
|
||||||
case "MARKREAD":
|
case "MARKREAD":
|
||||||
|
case "REDACT":
|
||||||
// Ignore these
|
// Ignore these
|
||||||
return [];
|
return [];
|
||||||
default:
|
default:
|
||||||
|
@ -94,7 +94,7 @@ function canFoldMessage(msg) {
|
|||||||
|
|
||||||
class LogLine extends Component {
|
class LogLine extends Component {
|
||||||
shouldComponentUpdate(nextProps) {
|
shouldComponentUpdate(nextProps) {
|
||||||
return this.props.message !== nextProps.message;
|
return this.props.message !== nextProps.message || this.props.redacted !== nextProps.redacted;
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -143,13 +143,18 @@ class LogLine extends Component {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
lineClass = "talk";
|
|
||||||
let prefix = "<", suffix = ">";
|
let prefix = "<", suffix = ">";
|
||||||
if (msg.command === "NOTICE") {
|
if (msg.command === "NOTICE") {
|
||||||
lineClass += " notice";
|
lineClass += " notice";
|
||||||
prefix = suffix = "-";
|
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;
|
let allowedPrefixes = server.statusMsg;
|
||||||
@ -710,6 +715,7 @@ export default class Buffer extends Component {
|
|||||||
message=${msg}
|
message=${msg}
|
||||||
buffer=${buf}
|
buffer=${buf}
|
||||||
server=${server}
|
server=${server}
|
||||||
|
redacted=${buf.redacted.has(msg.tags.msgid)}
|
||||||
onChannelClick=${onChannelClick}
|
onChannelClick=${onChannelClick}
|
||||||
onNickClick=${onNickClick}
|
onNickClick=${onNickClick}
|
||||||
onVerifyClick=${onVerifyClick}
|
onVerifyClick=${onVerifyClick}
|
||||||
|
@ -21,6 +21,7 @@ const permanentCaps = [
|
|||||||
"draft/account-registration",
|
"draft/account-registration",
|
||||||
"draft/chathistory",
|
"draft/chathistory",
|
||||||
"draft/extended-monitor",
|
"draft/extended-monitor",
|
||||||
|
"draft/message-redaction",
|
||||||
"draft/read-marker",
|
"draft/read-marker",
|
||||||
|
|
||||||
"soju.im/bouncer-networks",
|
"soju.im/bouncer-networks",
|
||||||
|
9
state.js
9
state.js
@ -361,6 +361,7 @@ export const State = {
|
|||||||
hasInitialWho: false, // if channel
|
hasInitialWho: false, // if channel
|
||||||
members: new irc.CaseMapMap(null, client.cm), // if channel
|
members: new irc.CaseMapMap(null, client.cm), // if channel
|
||||||
messages: [],
|
messages: [],
|
||||||
|
redacted: new Set(),
|
||||||
unread: Unread.NONE,
|
unread: Unread.NONE,
|
||||||
prevReadReceipt: null,
|
prevReadReceipt: null,
|
||||||
});
|
});
|
||||||
@ -665,6 +666,14 @@ export const State = {
|
|||||||
|
|
||||||
return { members };
|
return { members };
|
||||||
});
|
});
|
||||||
|
case "REDACT":
|
||||||
|
target = msg.params[0];
|
||||||
|
if (client.isMyNick(target)) {
|
||||||
|
target = msg.prefix.name;
|
||||||
|
}
|
||||||
|
return updateBuffer(target, (buf) => {
|
||||||
|
return { redacted: new Set(buf.redacted).add(msg.params[1]) };
|
||||||
|
});
|
||||||
case irc.RPL_MONONLINE:
|
case irc.RPL_MONONLINE:
|
||||||
case irc.RPL_MONOFFLINE:
|
case irc.RPL_MONOFFLINE:
|
||||||
targets = msg.params[1].split(",");
|
targets = msg.params[1].split(",");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user