From 14fa613d779fc4c4d82ae37df3d781bdde095b79 Mon Sep 17 00:00:00 2001 From: x Date: Sun, 25 Jan 2026 13:48:33 +0100 Subject: [PATCH] feat: Implement custom emojis, pinned comments, and thread locking features with schema updates and client-side logic. --- public/s/js/comments.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/public/s/js/comments.js b/public/s/js/comments.js index c54e93b..e920882 100644 --- a/public/s/js/comments.js +++ b/public/s/js/comments.js @@ -448,6 +448,27 @@ class CommentSystem { }); } + // Lock Thread + const lockBtn = this.container.querySelector('#lock-thread-btn'); + if (lockBtn) { + lockBtn.addEventListener('click', async () => { + const action = this.isLocked ? 'unlock' : 'lock'; + if (!confirm(`Admin: ${action.toUpperCase()} this thread?`)) return; + + try { + const res = await fetch(`/api/comments/${this.itemId}/lock`, { method: 'POST' }); + const json = await res.json(); + if (json.success) { + this.loadComments(); + } else { + alert('Failed to lock/unlock: ' + (json.message || 'Error')); + } + } catch (e) { + alert('Error: ' + e); + } + }); + } + // Permalinks this.container.addEventListener('click', (e) => { if (e.target.classList.contains('comment-permalink')) {