Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(chat): set CHAR_LIMIT for chat input

Calin-Teodor68106feb57f2
diff --git a/react/features/chat/components/native/ChatInputBar.tsx b/react/features/chat/components/native/ChatInputBar.tsx
index b0fcf1f422..e9a6e53a96 100644
--- a/react/features/chat/components/native/ChatInputBar.tsx
+++ b/react/features/chat/components/native/ChatInputBar.tsx
@@ -11,6 +11,8 @@ import IconButton from '../../../base/ui/components/native/IconButton';
import Input from '../../../base/ui/components/native/Input';
import { BUTTON_TYPES } from '../../../base/ui/constants.native';
+import { CHAR_LIMIT } from '../../constants';
+
import styles from './styles';
@@ -91,6 +93,7 @@ class ChatInputBar extends Component<IProps, IState> {
<Input
blurOnSubmit = { false }
customStyles = {{ container: styles.customInputContainer }}
+ maxLength = { CHAR_LIMIT }
multiline = { false }
onBlur = { this._onFocused(false) }
onChange = { this._onChangeText }
diff --git a/react/features/chat/components/web/ChatInput.tsx b/react/features/chat/components/web/ChatInput.tsx
index d274b2b81a..c0e42bbda8 100644
--- a/react/features/chat/components/web/ChatInput.tsx
+++ b/react/features/chat/components/web/ChatInput.tsx
@@ -8,6 +8,7 @@ import { translate } from '../../../base/i18n/functions';
import { IconFaceSmile, IconSend } from '../../../base/icons/svg';
import Button from '../../../base/ui/components/web/Button';
import Input from '../../../base/ui/components/web/Input';
+import { CHAR_LIMIT } from '../../constants';
import { areSmileysDisabled } from '../../functions';
import SmileysPanel from './SmileysPanel';
@@ -137,6 +138,7 @@ class ChatInput extends Component<IProps, IState> {
iconClick = { this._toggleSmileysPanel }
id = 'chat-input-messagebox'
maxRows = { 5 }
+ maxLength = { CHAR_LIMIT }
onChange = { this._onMessageChange }
onKeyPress = { this._onDetectSubmit }
placeholder = { this.props.t('chat.messagebox') }
diff --git a/react/features/chat/constants.ts b/react/features/chat/constants.ts
index 53b7776445..1718235320 100644
--- a/react/features/chat/constants.ts
+++ b/react/features/chat/constants.ts
@@ -48,3 +48,5 @@ export const TIMESTAMP_FORMAT = 'H:mm';
* The namespace for system messages.
*/
export const MESSAGE_TYPE_SYSTEM = 'system_chat_message';
+
+export const CHAR_LIMIT = 500;