don't require connection to view guild
This commit is contained in:
parent
afd2939fa1
commit
59856ca197
@ -20,7 +20,6 @@ const MessageList: FC<MessageListProps> = (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
|
||||
}, []);
|
||||
|
||||
|
@ -223,35 +223,23 @@ export default class CombinedGuild extends EventEmitter<Connectable & Conflictab
|
||||
resourceRAMCache: ResourceRAMCache,
|
||||
personalDB: PersonalDB
|
||||
) {
|
||||
if (guildMetadata.memberId === null) {
|
||||
throw new Error('trying to launch guild that we have never verified with');
|
||||
}
|
||||
const socket = socketio.connect(socketConfig.url, {
|
||||
forceNew: true,
|
||||
ca: socketConfig.cert
|
||||
});
|
||||
return new Promise<CombinedGuild>((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 {
|
||||
|
Loading…
Reference in New Issue
Block a user