From 59856ca1977f4eb6bbd5a6c6b09e4833edc9b880 Mon Sep 17 00:00:00 2001 From: Michael Peters Date: Mon, 24 Jan 2022 00:10:58 -0600 Subject: [PATCH] don't require connection to view guild --- .../webapp/elements/lists/message-list.tsx | 1 - src/client/webapp/guild-combined.ts | 38 +++++++------------ 2 files changed, 13 insertions(+), 26 deletions(-) diff --git a/src/client/webapp/elements/lists/message-list.tsx b/src/client/webapp/elements/lists/message-list.tsx index 5f4a4ad..3aa789d 100644 --- a/src/client/webapp/elements/lists/message-list.tsx +++ b/src/client/webapp/elements/lists/message-list.tsx @@ -20,7 +20,6 @@ const MessageList: FC = (props: MessageListProps) => { const scrollToBottomFunc = useCallback(() => { if (!infiniteScrollElementRef.current) return; - console.log('scrolling to bottom'); infiniteScrollElementRef.current.scrollTop = 0; // Keep in mind that this is reversed for flex-flow: column-reverse }, []); diff --git a/src/client/webapp/guild-combined.ts b/src/client/webapp/guild-combined.ts index a1ec419..0535a02 100644 --- a/src/client/webapp/guild-combined.ts +++ b/src/client/webapp/guild-combined.ts @@ -223,35 +223,23 @@ export default class CombinedGuild extends EventEmitter((resolve, reject) => { - const connectFail = (err: unknown) => { - socket.off('connect', connectSucceed); - reject(new Error('unable to connect: ' + (err as Error).message)); - } - const connectSucceed = async () => { - socket.off('connect_error', connectFail); - const socketVerifier = new SocketVerifier(socket, socketConfig.publicKey, socketConfig.privateKey); - const memberId = await socketVerifier.verify(); - if (guildMetadata.memberId && memberId !== guildMetadata.memberId) { - reject(new Error('Verified member differs from original member')); - } - resolve(new CombinedGuild( - guildMetadata.id, - memberId, - socket, - socketVerifier, - messageRAMCache, - resourceRAMCache, - personalDB - )); - } - socket.once('connect', connectSucceed); - socket.once('connect_error', connectFail); - }); + const socketVerifier = new SocketVerifier(socket, socketConfig.publicKey, socketConfig.privateKey); + return new CombinedGuild( + guildMetadata.id, + guildMetadata.memberId, + socket, + socketVerifier, + messageRAMCache, + resourceRAMCache, + personalDB + ); } public isSocketVerified(): boolean {