From 59e72998c6303748675554247e500f0f6162f128 Mon Sep 17 00:00:00 2001 From: Raven Scott Date: Fri, 14 Jun 2024 01:17:18 -0400 Subject: [PATCH] Fix message history by adding new clear function for internal command --- app.js | 13 ++++++++++++- commands.js | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index 4787082..4858e75 100644 --- a/app.js +++ b/app.js @@ -739,7 +739,7 @@ async function updateIcon(username, avatarBuffer) { } } -function clearMessages() { +function clearMessagesCMD() { const messagesContainer = document.querySelector('#messages'); while (messagesContainer.firstChild) { messagesContainer.removeChild(messagesContainer.firstChild); @@ -750,6 +750,17 @@ function clearMessages() { messagesStore[topic] = []; } +function clearMessages() { + const messagesContainer = document.querySelector('#messages'); + while (messagesContainer.firstChild) { + messagesContainer.removeChild(messagesContainer.firstChild); + } + + // Clear the messages from the store for the current room + // const topic = currentTopic(); + // messagesStore[topic] = []; +} + function toggleSetupView() { const setupDiv = document.querySelector('#setup'); setupDiv.classList.toggle('hidden'); diff --git a/commands.js b/commands.js index 9d4cf57..cc289b3 100644 --- a/commands.js +++ b/commands.js @@ -20,7 +20,7 @@ export default async function handleCommand(command, context) { switch (cmd) { case '~clear': - clearMessages(); + clearMessagesCMD(); break; case '~ping': addMessage('LinkUp', 'pong', agentAvatar, currentTopic());