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]) {
setChatChannelName(channels[chatChannel][0]);
}
}, [chatChannel]);
}, [chatChannel, channels]);
return (
<div

View File

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

View File

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

View File

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