瀏覽代碼

fix(chat): prevent empty messages

j8
Leonard Kim 6 年之前
父節點
當前提交
81d4f694b7
共有 1 個檔案被更改,包括 6 行新增2 行删除
  1. 6
    2
      react/features/chat/components/web/ChatInput.js

+ 6
- 2
react/features/chat/components/web/ChatInput.js 查看文件

@@ -157,9 +157,13 @@ class ChatInput extends Component<Props, State> {
157 157
             && event.shiftKey === false) {
158 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…
取消
儲存