give unregistered people access to chat channels

This commit is contained in:
HF 2022-02-10 22:53:38 +01:00
parent 6dc2084bc7
commit a8232757b1
4 changed files with 37 additions and 26 deletions

View File

@ -108,7 +108,7 @@ const ChannelDropDown = ({
if (channels[chatChannel]) { if (channels[chatChannel]) {
setChatChannelName(channels[chatChannel][0]); setChatChannelName(channels[chatChannel][0]);
} }
}, [chatChannel]); }, [chatChannel, channels]);
return ( return (
<div <div

View File

@ -167,14 +167,20 @@ const Chat = ({
))) )))
} }
</ul> </ul>
{(ownName) ? ( <form
<div className="chatinput"> className="chatinput"
<form onSubmit={(e) => handleSubmit(e)}
onSubmit={(e) => handleSubmit(e)} style={{
style={{ display: 'flex', flexDirection: 'row', height: '100%' }} display: 'flex',
> }}
>
{(ownName) ? (
<>
<input <input
style={{ flexGrow: 1, minWidth: 40 }} style={{
flexGrow: 1,
minWidth: 40,
}}
id={`chtipt-${windowId}`} id={`chtipt-${windowId}`}
value={inputMessage} value={inputMessage}
onChange={(e) => dispatch( onChange={(e) => dispatch(
@ -192,23 +198,27 @@ const Chat = ({
> >
</button> </button>
<ChannelDropDown </>
setChatChannel={setChannel} ) : (
chatChannel={chatChannel} <div
/> className="modallink"
</form> onClick={() => dispatch(showUserAreaModal())}
</div> style={{
) : ( textAlign: 'center',
<div fontSize: 13,
className="modallink" flexGrow: 1,
onClick={() => dispatch(showUserAreaModal())} }}
style={{ textAlign: 'center', fontSize: 13 }} role="button"
role="button" tabIndex={0}
tabIndex={0} >
> {t`You must be logged in to chat`}
{t`You must be logged in to chat`} </div>
</div> )}
)} <ChannelDropDown
setChatChannel={setChannel}
chatChannel={chatChannel}
/>
</form>
</div> </div>
); );
}; };

View File

@ -55,7 +55,7 @@ export default function chat(
const keys = Object.keys(channels); const keys = Object.keys(channels);
for (let i = 0; i < keys.length; i += 1) { for (let i = 0; i < keys.length; i += 1) {
const cid = keys[i]; const cid = keys[i];
if (channels[cid][1] === 0) { if (channels[cid][1] !== 0) {
delete messages[cid]; delete messages[cid];
delete channels[cid]; delete channels[cid];
} }

View File

@ -664,6 +664,7 @@ tr:nth-child(even) {
.chatinput { .chatinput {
height: 24px; height: 24px;
white-space: nowrap; white-space: nowrap;
display: flex;
} }
.chathead { .chathead {
display: flex; display: flex;