move comments from connecting_to_server_dialog_view

pull/787/head
Ryan Tharp 5 years ago
parent 8767a57ddd
commit 83e2404d89

@ -1056,6 +1056,7 @@
const sslServerURL = `https://${rawserverURL}`; const sslServerURL = `https://${rawserverURL}`;
const conversationId = `publicChat:${channelId}@${rawserverURL}`; const conversationId = `publicChat:${channelId}@${rawserverURL}`;
// quickly peak to make sure we don't already have it
const conversationExists = window.ConversationController.get( const conversationExists = window.ConversationController.get(
conversationId conversationId
); );
@ -1066,9 +1067,11 @@
}); });
} }
// get server
const serverAPI = await window.lokiPublicChatAPI.findOrCreateServer( const serverAPI = await window.lokiPublicChatAPI.findOrCreateServer(
sslServerURL sslServerURL
); );
// SSL certificate failure or offline
if (!serverAPI) { if (!serverAPI) {
// Url incorrect or server not compatible // Url incorrect or server not compatible
return new Promise((_resolve, reject) => { return new Promise((_resolve, reject) => {
@ -1076,16 +1079,20 @@
}); });
} }
// create conversation
const conversation = await window.ConversationController.getOrCreateAndWait( const conversation = await window.ConversationController.getOrCreateAndWait(
conversationId, conversationId,
'group' 'group'
); );
// convert conversation to a public one
await conversation.setPublicSource(sslServerURL, channelId); await conversation.setPublicSource(sslServerURL, channelId);
// set friend and appropriate SYNC messages for multidevice
await conversation.setFriendRequestStatus( await conversation.setFriendRequestStatus(
window.friends.friendRequestStatusEnum.friends window.friends.friendRequestStatusEnum.friends
); );
// and finally activate it
conversation.getPublicSendData(); // may want "await" if you want to use the API conversation.getPublicSendData(); // may want "await" if you want to use the API
return conversation; return conversation;

Loading…
Cancel
Save