From 8f90613951a9940d64fc45c0cad091311a761a09 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 3 Nov 2021 17:23:32 +0100 Subject: [PATCH] components/buffer-header: add help text for user details This makes it easier for users new to IRC to figure out what these things mean. Additionally, it's not possible for a malicious user to spoof the style. --- components/buffer-header.js | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/components/buffer-header.js b/components/buffer-header.js index 3fcc139..7fed7a0 100644 --- a/components/buffer-header.js +++ b/components/buffer-header.js @@ -144,20 +144,33 @@ export default function BufferHeader(props) { details.push(`${props.user.username}@${props.user.hostname}`); } if (props.user.account) { + let desc = `This user is verified and has logged in to the server with the account ${props.user.account}.`; + let item; if (props.user.account === props.buffer.name) { - details.push("authenticated"); + item = "authenticated"; } else { - details.push(`authenticated as ${props.user.account}`); + item = `authenticated as ${props.user.account}`; } + details.push(html`${item}`); } else if (props.server.isupport.has("MONITOR") && props.server.isupport.has("WHOX")) { // If the server supports MONITOR and WHOX, we can faithfully // keep user.account up-to-date for user queries - details.push("unauthenticated"); + let desc = "This user has not been verified and is not logged in."; + details.push(html`unauthenticated`); } if (props.user.operator) { - details.push("server operator"); + let desc = "This user is a server operator, they have administrator privileges."; + details.push(html`server operator`); + } + details = details.map((item, i) => { + if (i === 0) { + return item; + } + return [", ", item]; + }); + if (details.length > 0) { + details = ["(", details, ")"]; } - details = details.length > 0 ? `(${details.join(", ")})` : null; description = html`<${NickStatus} status=${status}/> ${realname} ${details}`; }