don't show bot messages unless the user initiated them

This commit is contained in:
Sharon Kennedy 2020-03-20 16:47:13 -04:00
parent 3935287c3f
commit 792a994ef5

View File

@ -343,6 +343,14 @@ class ChatBox extends React.Component {
content: event.getContent(),
}
if (message.content.showToUser && message.content.showToUser !== this.state.userId) {
return;
}
if (message.content.body.startsWith('!bot') && message.sender !== this.state.userId) {
return;
}
const messages = [...this.state.messages]
messages.push(message)
this.setState({ messages })