From 72711642560d4565cb48dcbee54115e8688359e1 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Wed, 21 Feb 2024 19:49:16 +0530 Subject: [PATCH] Set chat session title to textContent of the chat session HTML element We don't expect/want the user to use HTML titles for chat session --- src/interface/desktop/chat.html | 6 +++--- src/khoj/interface/web/chat.html | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/interface/desktop/chat.html b/src/interface/desktop/chat.html index 6d5ced15..d404a517 100644 --- a/src/interface/desktop/chat.html +++ b/src/interface/desktop/chat.html @@ -104,7 +104,7 @@ linkElement.classList.add("inline-chat-link"); linkElement.classList.add("reference-link"); linkElement.setAttribute('title', title); - linkElement.innerHTML = title; + linkElement.textContent = title; let referenceButton = document.createElement('button'); referenceButton.innerHTML = linkElement.outerHTML; @@ -785,7 +785,7 @@ let conversationButton = document.createElement('div'); let incomingConversationId = conversation["conversation_id"]; const conversationTitle = conversation["slug"] || `New conversation 🌱`; - conversationButton.innerHTML = conversationTitle; + conversationButton.textContent = conversationTitle; conversationButton.classList.add("conversation-button"); if (incomingConversationId == conversationId) { conversationButton.classList.add("selected-conversation"); @@ -883,7 +883,7 @@ fetch(`${hostURL}${editURL}` , { method: "PATCH" }) .then(response => response.ok ? response.json() : Promise.reject(response)) .then(data => { - conversationButton.innerHTML = newTitle; + conversationButton.textContent = newTitle; }) .catch(err => { return; diff --git a/src/khoj/interface/web/chat.html b/src/khoj/interface/web/chat.html index 91751002..c83be7f1 100644 --- a/src/khoj/interface/web/chat.html +++ b/src/khoj/interface/web/chat.html @@ -116,7 +116,7 @@ To get started, just start typing below. You can also type / to see a list of co linkElement.classList.add("inline-chat-link"); linkElement.classList.add("reference-link"); linkElement.setAttribute('title', title); - linkElement.innerHTML = title; + linkElement.textContent = title; let referenceButton = document.createElement('button'); referenceButton.innerHTML = linkElement.outerHTML; @@ -713,7 +713,7 @@ To get started, just start typing below. You can also type / to see a list of co let conversationButton = document.createElement('div'); let incomingConversationId = conversation["conversation_id"]; const conversationTitle = conversation["slug"] || `New conversation 🌱`; - conversationButton.innerHTML = conversationTitle; + conversationButton.textContent = conversationTitle; conversationButton.classList.add("conversation-button"); if (incomingConversationId == conversationId) { conversationButton.classList.add("selected-conversation"); @@ -789,7 +789,7 @@ To get started, just start typing below. You can also type / to see a list of co fetch(editURL , { method: "PATCH" }) .then(response => response.ok ? response.json() : Promise.reject(response)) .then(data => { - conversationButton.innerHTML = newTitle; + conversationButton.textContent = newTitle; }) .catch(err => { return;