From 792a994ef5c4b18187f3187fd95589e6757cb905 Mon Sep 17 00:00:00 2001 From: Sharon Kennedy Date: Fri, 20 Mar 2020 16:47:13 -0400 Subject: [PATCH] don't show bot messages unless the user initiated them --- src/components/chatbox.jsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/components/chatbox.jsx b/src/components/chatbox.jsx index 479b47e..12e94fa 100644 --- a/src/components/chatbox.jsx +++ b/src/components/chatbox.jsx @@ -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 })