From 96dd8476ad3edf1311f9577456c04f31c05a53fa Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 5 Nov 2021 15:00:08 +0100 Subject: [PATCH] De-duplicate nicks in folded JOIN/PART/QUIT lines --- components/buffer.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/buffer.js b/components/buffer.js index 0987bf2..d08e12e 100644 --- a/components/buffer.js +++ b/components/buffer.js @@ -297,7 +297,9 @@ class FoldGroup extends Component { return; } - let plural = byCommand[cmd].length > 1; + let nicks = new Set(byCommand[cmd].map((msg) => msg.prefix.name)); + + let plural = nicks.size > 1; let action; switch (cmd) { case "JOIN": @@ -317,9 +319,7 @@ class FoldGroup extends Component { content.push(", "); } - let nicks = byCommand[cmd].map((msg) => msg.prefix.name); - - content.push(createNickList(nicks, createNick)); + content.push(createNickList([...nicks], createNick)); content.push(" " + action); });