Handle conversation deleted event

This commit is contained in:
Pierre HUBERT 2021-03-13 13:39:03 +01:00
parent 0a5a2637f5
commit 54d8245f91
3 changed files with 21 additions and 1 deletions

View File

@ -217,6 +217,10 @@ class UserWebSocket {
SendEvent("removedUserFromConv", msg.data); SendEvent("removedUserFromConv", msg.data);
break; break;
case "deleted_conversation":
SendEvent("deletedConversation", msg.data);
break;
case "new_comment": case "new_comment":
SendEvent("new_comment", msg.data); SendEvent("new_comment", msg.data);
break; break;

View File

@ -1506,3 +1506,12 @@ document.addEventListener("removedUserFromConv", e => {
ConvChatWindow.__conversationsCache["conversation-"+msg.conv_id].box.closeFunction(); ConvChatWindow.__conversationsCache["conversation-"+msg.conv_id].box.closeFunction();
}); });
document.addEventListener("deletedConversation", e => {
const convID = e.detail;
if(!ConvService.__serviceCache.hasOwnProperty("conversation-" + convID))
return;
ConvChatWindow.__conversationsCache["conversation-"+convID].box.closeFunction();
});

View File

@ -696,6 +696,13 @@ document.addEventListener("deletedConvMessage", (e) => {
document.addEventListener("removedUserFromConv", e => { document.addEventListener("removedUserFromConv", e => {
const msg = e.detail; const msg = e.detail;
if (msg.user_id == userID() && ConversationPageConvPart._conv_info.id) if (msg.user_id == userID() && ConversationPageConvPart._conv_info.id == msg.conv_id)
Page.openPage("conversations");
});
document.addEventListener("deletedConversation", e => {
const convID = e.detail;
if (ConversationPageConvPart._conv_info.id == convID)
Page.openPage("conversations"); Page.openPage("conversations");
}); });