Browse Source

fix(chat): prevent empty messages

master
Leonard Kim 6 years ago
parent
commit
81d4f694b7
1 changed files with 6 additions and 2 deletions
  1. 6
    2
      react/features/chat/components/web/ChatInput.js

+ 6
- 2
react/features/chat/components/web/ChatInput.js View File

157
             && event.shiftKey === false) {
157
             && event.shiftKey === false) {
158
             event.preventDefault();
158
             event.preventDefault();
159
 
159
 
160
-            this.props.dispatch(sendMessage(this.state.message));
160
+            const trimmed = this.state.message.trim();
161
 
161
 
162
-            this.setState({ message: '' });
162
+            if (trimmed) {
163
+                this.props.dispatch(sendMessage(trimmed));
164
+
165
+                this.setState({ message: '' });
166
+            }
163
         }
167
         }
164
     }
168
     }
165
 
169
 

Loading…
Cancel
Save