fix: room case-insensitivity

This commit is contained in:
cha0s 2020-07-24 07:49:27 -05:00
parent d20466d10f
commit fd1de29781
2 changed files with 9 additions and 3 deletions

View File

@ -25,6 +25,7 @@
.channels__joinText {
flex-grow: 1;
padding-left: 0.25em;
text-transform: lowercase;
width: 0%;
&:focus {
font-size: 1.5em;

View File

@ -1,6 +1,6 @@
import './chat.scss';
import {goBack, replace} from 'connected-react-router';
import {goBack, push, replace} from 'connected-react-router';
import React, {useEffect, useRef} from 'react';
import {useSelector, useDispatch} from 'react-redux';
@ -28,12 +28,17 @@ export default function Chat() {
useEffect(() => {
if (!allowedUser) {
dispatch(historyLength > 1 ? goBack() : replace('/'));
return;
}
if (channel !== channel.toLowerCase()) {
dispatch(push(`/chat${channel.toLowerCase()}`));
return;
}
if (!hasChannel && validateChannel(channel)) {
dispatch(submitJoin({channel, id: user.id}));
dispatch(submitJoin({channel: channel.toLowerCase(), id: user.id}));
}
});
if (!allowedUser) {
if (!allowedUser || !hasChannel) {
return null;
}
let origin;