main
jerl 2023-11-01 00:14:19 -07:00
parent 9e4e2ba299
commit 8cd970e4f8
2 changed files with 6 additions and 7 deletions

View File

@ -9,7 +9,7 @@ function chooseThread(thread) {
window.currentThreadId = thread.id;
window.earliestMessage = null;
document.getElementById("messages").innerHTML = "";
document.getElementById("threadname").innerHTML = thread.name;
document.getElementById("threadname").textContent = thread.name;
loadMessages();
}
@ -51,9 +51,8 @@ function addThread(thread) {
function addMember() {
const name = document.getElementById("membername").value;
window.threadmembers.push(name);
document.getElementById("memberlist").appendChild(html.node`
<p class='member'>${name}</p>
`);
document.getElementById("memberlist").appendChild(
html.node`<p class='member'>${name}</p>`);
document.getElementById("membername").value = "";
}
@ -177,11 +176,11 @@ render(document.body, html`
<div id="threadlist">loading...</div>
<button id='newthread' onclick=${newThread}>create</button>
</div>
<div id="chat" class="column">
<div id="thread" class="column">
<h3>
thread: <strong id="threadname">meow</strong>
</h3>
<h3>messages will appear below as they are sent</h3>
<h3>messages</h3>
<button id="loadmore" class="hidden" onclick=${loadMessages}>load more messages</button>
<div id="messages"></div>
<form id="msginput" onsubmit=${sendMessage}>

View File

@ -57,7 +57,7 @@ const create_thread = async (msg, respond, socket, io) => {
for (let user of msg.members) {
// get user id
const id = await db.query("select id from users where name = ?", [
user.user,
user.name,
]);
if (id.rows.length > 0) {
const user_id = id.rows[0].id;