diff --git a/assets/js/common/ws.js b/assets/js/common/ws.js index bc2c6d5f..5444f7bd 100644 --- a/assets/js/common/ws.js +++ b/assets/js/common/ws.js @@ -202,6 +202,10 @@ class UserWebSocket { SendEvent("updatedConvMessage", msg.data); break; + case "deleted_conv_message": + SendEvent("deletedConvMessage", msg.data.ID); + break; + case "new_comment": SendEvent("new_comment", msg.data); break; diff --git a/assets/js/components/conversations/chatWindows.js b/assets/js/components/conversations/chatWindows.js index b1f11968..9086452c 100644 --- a/assets/js/components/conversations/chatWindows.js +++ b/assets/js/components/conversations/chatWindows.js @@ -1188,4 +1188,16 @@ document.addEventListener("updatedConvMessage", (e) => { target.replaceWith(ConvChatWindow._get_message_element(convInfo, msg).rootElem) -}); \ No newline at end of file +}); + +// Register to message deletion events +document.addEventListener("deletedConvMessage", (e) => { + const msgID = e.detail; + + // Get message target + const target = document.querySelector("[data-chatwin-msg-id='"+msgID+"'] .direct-chat-text"); + if(!target) + return; + + target.style.display = "none"; +}) \ No newline at end of file