components/buffer: drop duplicate MONITOR events

This commit is contained in:
Simon Ser 2023-11-10 18:11:34 +01:00
parent e0de4d1b36
commit 68cb6c56c4

View file

@ -660,7 +660,7 @@ export default class Buffer extends Component {
let hasUnreadSeparator = false; let hasUnreadSeparator = false;
let prevDate = new Date(); let prevDate = new Date();
let foldMessages = []; let foldMessages = [];
let hasMonitor = false; let lastMonitor = null;
buf.messages.forEach((msg) => { buf.messages.forEach((msg) => {
let sep = []; let sep = [];
@ -668,9 +668,12 @@ export default class Buffer extends Component {
return; return;
} }
if (!hasMonitor && (msg.command === irc.RPL_MONONLINE || msg.command === irc.RPL_MONOFFLINE)) { if (msg.command === irc.RPL_MONONLINE || msg.command === irc.RPL_MONOFFLINE) {
hasMonitor = true; let skip = !lastMonitor || msg.command === lastMonitor;
return; lastMonitor = msg.command;
if (skip) {
return;
}
} }
if (!hasUnreadSeparator && buf.type != BufferType.SERVER && !isMessageBeforeReceipt(msg, buf.prevReadReceipt)) { if (!hasUnreadSeparator && buf.type != BufferType.SERVER && !isMessageBeforeReceipt(msg, buf.prevReadReceipt)) {