OpenGrop joining

This commit is contained in:
Vincent 2020-07-08 10:19:51 +10:00
parent 54209e98a8
commit ab966e600a

View file

@ -83,6 +83,7 @@ export class OpenGroup {
}
public static async join(server: string): Promise<OpenGroup | undefined> {
const prefixedServer = OpenGroup.prefixify(server);
if (!OpenGroup.validate(server)) {
return;
}
@ -90,17 +91,20 @@ export class OpenGroup {
// Make this not hard coded
const channel = 1;
let conversation;
let conversationId;
try {
conversation = await window.attemptConnection(server, channel);
conversation = await window.attemptConnection(prefixedServer, channel);
conversationId = conversation?.cid;
} catch (e) {
console.warn(e);
return;
}
// Do we want to add conversation as a property of OpenGroup?
return new OpenGroup({
server,
channel,
conversationId: conversation?.cid,
conversationId,
});
}