From 4aa066768606c37c4ae9909a62104c4925aab37b Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Thu, 9 Jul 2020 10:33:26 +1000 Subject: [PATCH] OpenGroup: get conversation from conversationController rather than appDotNetApi --- ts/session/types/OpenGroup.ts | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/ts/session/types/OpenGroup.ts b/ts/session/types/OpenGroup.ts index 462a21589..290e1c7f9 100644 --- a/ts/session/types/OpenGroup.ts +++ b/ts/session/types/OpenGroup.ts @@ -152,17 +152,14 @@ export class OpenGroup { if (!OpenGroup.validate(server)) { return; } - - const prefixedServer = this.prefixify(server); - const serverInfo = (await window.lokiPublicChatAPI.findOrCreateServer( - prefixedServer - )) as any; - - if (!serverInfo?.channels?.length) { - return; - } - - return serverInfo.channels[0].conversation; + const rawServerURL = server + .replace(/^https?:\/\//i, '') + .replace(/[/\\]+$/i, ''); + const channelId = 1; + const conversationId = `publicChat:${channelId}@${rawServerURL}`; + + // Quickly peak to make sure we don't already have it + return window.ConversationController.get(conversationId); } /**