This commit is contained in:
retoor 2025-05-25 01:25:43 +02:00
parent 2a5b9ad276
commit 81327a9e20

View File

@ -47,14 +47,14 @@ class ChatInputComponent extends HTMLElement {
this.textarea.focus(); this.textarea.focus();
} }
getAuthors(){ getAuthors(){
const uniqueAuthors = new Set() let authors = []
document.querySelectorAll('div.author').forEach(el=> for (let i = 0; i < this.users.length; i++) {
{ authors.push(this.users[i].username)
uniqueAuthors.add(el.innerText.trim()) authors.push(this.users[i].nick)
}) }
return authors
return Array.from(uniqueAuthors)
} }
extractMentions(text) { extractMentions(text) {
const regex = /@([a-zA-Z0-9_]+)/g; const regex = /@([a-zA-Z0-9_]+)/g;
const mentions = []; const mentions = [];
@ -136,12 +136,16 @@ levenshteinDistance(a, b) {
app.rpc.getUser(null).then((user) => { app.rpc.getUser(null).then((user) => {
this.user=user this.user=user
}) })
const me = this; const me = this;
this.liveType = this.getAttribute("live-type") === "true"; this.liveType = this.getAttribute("live-type") === "true";
this.liveTypeInterval = this.liveTypeInterval =
parseInt(this.getAttribute("live-type-interval")) || 3; parseInt(this.getAttribute("live-type-interval")) || 3;
this.channelUid = this.getAttribute("channel"); this.channelUid = this.getAttribute("channel");
this.messageUid = null;
this.users = await app.rpc.getUsers(this.channelUid)
this.messageUid = null;
this.classList.add("chat-input"); this.classList.add("chat-input");