diff --git a/assets/js/common/ws.js b/assets/js/common/ws.js index 3b32a904..b3084258 100644 --- a/assets/js/common/ws.js +++ b/assets/js/common/ws.js @@ -209,6 +209,10 @@ class UserWebSocket { SendEvent("deletedConvMessage", msg.data.id); break; + case "removed_user_from_conv": + SendEvent("removedUserFromConv", msg.data); + break; + case "new_comment": SendEvent("new_comment", msg.data); break; diff --git a/assets/js/pages/conversations/conversation.js b/assets/js/pages/conversations/conversation.js index 770b8f87..9f840dc4 100644 --- a/assets/js/pages/conversations/conversation.js +++ b/assets/js/pages/conversations/conversation.js @@ -685,4 +685,12 @@ document.addEventListener("deletedConvMessage", (e) => { return; target.parentNode.remove() -}) \ No newline at end of file +}) + +// Register to conversation removal +document.addEventListener("removedUserFromConv", e => { + const msg = e.detail; + + if (msg.user_id == userID() && ConversationPageConvPart._conv_info.id) + Page.openPage("conversations"); +}); \ No newline at end of file