diff --git a/assets/js/ticket.js b/assets/js/ticket.js
index 13355a0..dbbd415 100644
--- a/assets/js/ticket.js
+++ b/assets/js/ticket.js
@@ -1232,7 +1232,6 @@ document.addEventListener('DOMContentLoaded', function() {
if (!target) return;
const action = target.dataset.action;
- console.log('Action clicked:', action, 'Target:', target);
switch (action) {
case 'remove-dependency':
removeDependency(target.dataset.dependencyId);
@@ -1464,13 +1463,10 @@ function deleteComment(commentId) {
* Show reply form for a comment
*/
function showReplyForm(commentId, userName) {
- console.log('showReplyForm called:', commentId, userName);
-
// Remove any existing reply forms
document.querySelectorAll('.reply-form-container').forEach(form => form.remove());
const commentDiv = document.querySelector(`.comment[data-comment-id="${commentId}"]`);
- console.log('commentDiv found:', commentDiv);
if (!commentDiv) return;
const replyFormHtml = `
@@ -1549,10 +1545,68 @@ function submitReply(parentCommentId) {
// Close the reply form
closeReplyForm();
- // Reload page to show the new threaded comment properly
- // (Threading requires proper hierarchical rendering)
+ // Dynamically add the reply to the DOM
+ const parentComment = document.querySelector(`.comment[data-comment-id="${parentCommentId}"]`);
+ if (parentComment) {
+ // Get or create replies container
+ let repliesContainer = parentComment.querySelector('.comment-replies');
+ if (!repliesContainer) {
+ repliesContainer = document.createElement('div');
+ repliesContainer.className = 'comment-replies';
+ parentComment.appendChild(repliesContainer);
+ }
+
+ // Get parent's thread depth
+ const parentDepth = parseInt(parentComment.dataset.threadDepth) || 0;
+ const newDepth = Math.min(parentDepth + 1, 3);
+
+ // Format the comment text for display
+ let displayText;
+ if (isMarkdownEnabled) {
+ displayText = typeof parseMarkdown === 'function' ? parseMarkdown(commentText) : commentText;
+ } else {
+ displayText = commentText
+ .replace(/&/g, '&')
+ .replace(//g, '>')
+ .replace(/"/g, '"')
+ .replace(/'/g, ''')
+ .replace(/\n/g, '
');
+ }
+
+ // Create the new reply element
+ const replyDiv = document.createElement('div');
+ replyDiv.className = `comment thread-depth-${newDepth} comment-reply`;
+ replyDiv.dataset.commentId = data.comment_id;
+ replyDiv.dataset.markdownEnabled = isMarkdownEnabled ? '1' : '0';
+ replyDiv.dataset.threadDepth = newDepth;
+ replyDiv.dataset.parentId = parentCommentId;
+
+ replyDiv.innerHTML = `
+