From 30ed04a3b1065c46ae320e36f5a011d5e50f63d9 Mon Sep 17 00:00:00 2001 From: Ryan Tharp Date: Thu, 21 Nov 2019 17:44:00 -0800 Subject: [PATCH] tell the server when you leave the channel --- js/conversation_controller.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/js/conversation_controller.js b/js/conversation_controller.js index 3f83d6b61..3619f3e62 100644 --- a/js/conversation_controller.js +++ b/js/conversation_controller.js @@ -1,4 +1,4 @@ -/* global _, Whisper, Backbone, storage, textsecure, libsignal, lokiPublicChatAPI */ +/* global _, Whisper, Backbone, storage, textsecure, libsignal, log */ /* eslint-disable more/no-then */ @@ -160,8 +160,12 @@ return; } if (conversation.isPublic()) { - const server = conversation.getPublicSource(); - lokiPublicChatAPI.unregisterChannel(server.server, server.channelId); + const channelAPI = await conversation.getPublicSendData(); + if (channelAPI === null) { + log.warn(`Could not get API for public conversation ${id}`); + } else { + channelAPI.serverAPI.partChannel(channelAPI.channelId); + } } await conversation.destroyMessages(); const deviceIds = await textsecure.storage.protocol.getDeviceIds(id);