소스 검색

fix(chat): prevent empty messages

master
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…
취소
저장