From 81327a9e2033b7dd802cce92baf436b0cd23e018 Mon Sep 17 00:00:00 2001 From: retoor Date: Sun, 25 May 2025 01:25:43 +0200 Subject: [PATCH] Update. --- src/snek/static/chat-input.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/snek/static/chat-input.js b/src/snek/static/chat-input.js index f8ce09f..a97b467 100644 --- a/src/snek/static/chat-input.js +++ b/src/snek/static/chat-input.js @@ -47,14 +47,14 @@ class ChatInputComponent extends HTMLElement { this.textarea.focus(); } getAuthors(){ - const uniqueAuthors = new Set() - document.querySelectorAll('div.author').forEach(el=> - { - uniqueAuthors.add(el.innerText.trim()) - }) - - return Array.from(uniqueAuthors) -} + let authors = [] + for (let i = 0; i < this.users.length; i++) { + authors.push(this.users[i].username) + authors.push(this.users[i].nick) + } + return authors + + } extractMentions(text) { const regex = /@([a-zA-Z0-9_]+)/g; const mentions = []; @@ -136,12 +136,16 @@ levenshteinDistance(a, b) { app.rpc.getUser(null).then((user) => { this.user=user }) + + const me = this; this.liveType = this.getAttribute("live-type") === "true"; this.liveTypeInterval = parseInt(this.getAttribute("live-type-interval")) || 3; this.channelUid = this.getAttribute("channel"); - this.messageUid = null; + + this.users = await app.rpc.getUsers(this.channelUid) + this.messageUid = null; this.classList.add("chat-input");