diff --git a/src/pages/home/report/ReportActionItemMessageEdit.js b/src/pages/home/report/ReportActionItemMessageEdit.js index 49a442e9b031..2f993268562e 100644 --- a/src/pages/home/report/ReportActionItemMessageEdit.js +++ b/src/pages/home/report/ReportActionItemMessageEdit.js @@ -19,6 +19,8 @@ import EmojiPickerButton from '../../../components/EmojiPicker/EmojiPickerButton import * as ReportActionContextMenu from './ContextMenu/ReportActionContextMenu'; import VirtualKeyboard from '../../../libs/VirtualKeyboard'; import reportPropTypes from '../../reportPropTypes'; +import ExceededCommentLength from '../../../components/ExceededCommentLength'; +import CONST from '../../../CONST'; const propTypes = { /** All the data of the action */ @@ -131,6 +133,11 @@ class ReportActionItemMessageEdit extends React.Component { * the new content. */ publishDraft() { + // Do nothing if draft exceed the character limit + if (this.state.draft.length > CONST.MAX_COMMENT_LENGTH) { + return; + } + // To prevent re-mount after user saves edit before debounce duration (example: within 1 second), we cancel // debounce here. this.debouncedSaveDraft.cancel(); @@ -186,9 +193,10 @@ class ReportActionItemMessageEdit extends React.Component { } render() { + const hasExceededMaxCommentLength = this.state.draft.length > CONST.MAX_COMMENT_LENGTH; return ( - + { @@ -235,11 +243,13 @@ class ReportActionItemMessageEdit extends React.Component {