From 83e2404d8948e8f5a8d5cf7221aa61f8d34351aa Mon Sep 17 00:00:00 2001 From: Ryan Tharp Date: Tue, 4 Feb 2020 15:24:09 -0800 Subject: [PATCH] move comments from connecting_to_server_dialog_view --- js/background.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/js/background.js b/js/background.js index 3c6330ebf..508da29d5 100644 --- a/js/background.js +++ b/js/background.js @@ -1056,6 +1056,7 @@ const sslServerURL = `https://${rawserverURL}`; const conversationId = `publicChat:${channelId}@${rawserverURL}`; + // quickly peak to make sure we don't already have it const conversationExists = window.ConversationController.get( conversationId ); @@ -1066,9 +1067,11 @@ }); } + // get server const serverAPI = await window.lokiPublicChatAPI.findOrCreateServer( sslServerURL ); + // SSL certificate failure or offline if (!serverAPI) { // Url incorrect or server not compatible return new Promise((_resolve, reject) => { @@ -1076,16 +1079,20 @@ }); } + // create conversation const conversation = await window.ConversationController.getOrCreateAndWait( conversationId, 'group' ); + // convert conversation to a public one await conversation.setPublicSource(sslServerURL, channelId); + // set friend and appropriate SYNC messages for multidevice await conversation.setFriendRequestStatus( window.friends.friendRequestStatusEnum.friends ); + // and finally activate it conversation.getPublicSendData(); // may want "await" if you want to use the API return conversation;