mirror of
https://github.com/owncast/owncast.git
synced 2024-11-26 14:56:14 +03:00
Merge pull request #146 from owncast/gek/fix-disabled-chat
Fix chat not coming back after server comes back.
This commit is contained in:
commit
75db8c1edb
2 changed files with 26 additions and 36 deletions
|
@ -44,7 +44,7 @@ export default class App extends Component {
|
||||||
this.state = {
|
this.state = {
|
||||||
websocket: new Websocket(),
|
websocket: new Websocket(),
|
||||||
displayChat: getLocalStorage(KEY_CHAT_DISPLAYED) || true, // chat panel state
|
displayChat: getLocalStorage(KEY_CHAT_DISPLAYED) || true, // chat panel state
|
||||||
chatEnabled: false, // chat input box state
|
chatInputEnabled: false, // chat input box state
|
||||||
username: getLocalStorage(KEY_USERNAME) || generateUsername(),
|
username: getLocalStorage(KEY_USERNAME) || generateUsername(),
|
||||||
userAvatarImage:
|
userAvatarImage:
|
||||||
getLocalStorage(KEY_AVATAR) ||
|
getLocalStorage(KEY_AVATAR) ||
|
||||||
|
@ -283,7 +283,7 @@ export default class App extends Component {
|
||||||
this.setState({
|
this.setState({
|
||||||
playerActive: true,
|
playerActive: true,
|
||||||
streamOnline: true,
|
streamOnline: true,
|
||||||
chatEnabled: true,
|
chatInputEnabled: true,
|
||||||
streamStatusMessage: MESSAGE_ONLINE,
|
streamStatusMessage: MESSAGE_ONLINE,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -323,7 +323,7 @@ export default class App extends Component {
|
||||||
|
|
||||||
disableChatInput() {
|
disableChatInput() {
|
||||||
this.setState({
|
this.setState({
|
||||||
chatEnabled: false,
|
chatInputEnabled: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,7 +340,7 @@ export default class App extends Component {
|
||||||
|
|
||||||
render(props, state) {
|
render(props, state) {
|
||||||
const {
|
const {
|
||||||
chatEnabled,
|
chatInputEnabled,
|
||||||
configData,
|
configData,
|
||||||
displayChat,
|
displayChat,
|
||||||
extraUserContent,
|
extraUserContent,
|
||||||
|
@ -538,7 +538,7 @@ export default class App extends Component {
|
||||||
websocket=${websocket}
|
websocket=${websocket}
|
||||||
username=${username}
|
username=${username}
|
||||||
userAvatarImage=${userAvatarImage}
|
userAvatarImage=${userAvatarImage}
|
||||||
chatEnabled=${chatEnabled}
|
chatInputEnabled=${chatInputEnabled}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -144,18 +144,6 @@ export default class Chat extends Component {
|
||||||
this.websocket.send(message);
|
this.websocket.send(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
disableChat() {
|
|
||||||
this.setState({
|
|
||||||
inputEnabled: false,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
enableChat() {
|
|
||||||
this.setState({
|
|
||||||
inputEnabled: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
updateAuthorList(message) {
|
updateAuthorList(message) {
|
||||||
const { type } = message;
|
const { type } = message;
|
||||||
const nameList = this.state.chatUserNames;
|
const nameList = this.state.chatUserNames;
|
||||||
|
@ -175,7 +163,7 @@ export default class Chat extends Component {
|
||||||
|
|
||||||
|
|
||||||
render(props, state) {
|
render(props, state) {
|
||||||
const { username, messagesOnly, chatEnabled } = props;
|
const { username, messagesOnly, chatInputEnabled } = props;
|
||||||
const { messages, inputEnabled, chatUserNames } = state;
|
const { messages, inputEnabled, chatUserNames } = state;
|
||||||
|
|
||||||
const messageList = messages.map((message) => (html`<${Message} message=${message} username=${username} key=${message.id} />`));
|
const messageList = messages.map((message) => (html`<${Message} message=${message} username=${username} key=${message.id} />`));
|
||||||
|
@ -193,10 +181,12 @@ export default class Chat extends Component {
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return html`
|
||||||
html`
|
|
||||||
<section id="chat-container-wrap" class="flex flex-col">
|
<section id="chat-container-wrap" class="flex flex-col">
|
||||||
<div id="chat-container" class="bg-gray-800 flex flex-col justify-end overflow-auto">
|
<div
|
||||||
|
id="chat-container"
|
||||||
|
class="bg-gray-800 flex flex-col justify-end overflow-auto"
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
id="messages-container"
|
id="messages-container"
|
||||||
ref=${this.scrollableMessagesContainer}
|
ref=${this.scrollableMessagesContainer}
|
||||||
|
@ -206,12 +196,12 @@ export default class Chat extends Component {
|
||||||
</div>
|
</div>
|
||||||
<${ChatInput}
|
<${ChatInput}
|
||||||
chatUserNames=${chatUserNames}
|
chatUserNames=${chatUserNames}
|
||||||
inputEnabled=${chatEnabled && inputEnabled}
|
inputEnabled=${chatInputEnabled}
|
||||||
handleSendMessage=${this.submitChat}
|
handleSendMessage=${this.submitChat}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
`);
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue