diff --git a/package-lock.json b/package-lock.json index cba55e1f6f2b5..47c2d473376f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38,7 +38,7 @@ "dom-serializer": "^0.2.2", "domhandler": "^4.3.0", "dotenv": "^8.2.0", - "expensify-common": "git+https://github.com/Expensify/expensify-common.git#db2c245c1e6b39232092b1415b9235fadda2a529", + "expensify-common": "git+https://github.com/Expensify/expensify-common.git#6bd112f1e7ebbd6679042fa04060104b68beace2", "fbjs": "^3.0.2", "file-loader": "^6.0.0", "html-entities": "^1.3.1", @@ -23861,8 +23861,8 @@ }, "node_modules/expensify-common": { "version": "1.0.0", - "resolved": "git+ssh://git@github.com/Expensify/expensify-common.git#db2c245c1e6b39232092b1415b9235fadda2a529", - "integrity": "sha512-2FlkWOBJcLxWXUimYFu/Wa/0955YkCM5Wyd1+pwXYSjplQsoH4EHWJISfzHW85OhNbN8eOMmo8SOy3gHgwACAw==", + "resolved": "git+ssh://git@github.com/Expensify/expensify-common.git#6bd112f1e7ebbd6679042fa04060104b68beace2", + "integrity": "sha512-9KDdGIiV9aSZloy+lWtaBrZrrEwS+Fp9T8+KoWa6E+nrS+Y9kx55vRHGIPpDeMqFk8hMfaBiYwQ7/wQmc2ijeg==", "license": "MIT", "dependencies": { "classnames": "2.3.1", @@ -60824,9 +60824,9 @@ } }, "expensify-common": { - "version": "git+ssh://git@github.com/Expensify/expensify-common.git#db2c245c1e6b39232092b1415b9235fadda2a529", - "integrity": "sha512-2FlkWOBJcLxWXUimYFu/Wa/0955YkCM5Wyd1+pwXYSjplQsoH4EHWJISfzHW85OhNbN8eOMmo8SOy3gHgwACAw==", - "from": "expensify-common@git+https://github.com/Expensify/expensify-common.git#db2c245c1e6b39232092b1415b9235fadda2a529", + "version": "git+ssh://git@github.com/Expensify/expensify-common.git#6bd112f1e7ebbd6679042fa04060104b68beace2", + "integrity": "sha512-9KDdGIiV9aSZloy+lWtaBrZrrEwS+Fp9T8+KoWa6E+nrS+Y9kx55vRHGIPpDeMqFk8hMfaBiYwQ7/wQmc2ijeg==", + "from": "expensify-common@git+https://github.com/Expensify/expensify-common.git#6bd112f1e7ebbd6679042fa04060104b68beace2", "requires": { "classnames": "2.3.1", "clipboard": "2.0.4", diff --git a/package.json b/package.json index c9362fbaa66f1..9602b22d3b703 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "dom-serializer": "^0.2.2", "domhandler": "^4.3.0", "dotenv": "^8.2.0", - "expensify-common": "git+https://github.com/Expensify/expensify-common.git#db2c245c1e6b39232092b1415b9235fadda2a529", + "expensify-common": "git+https://github.com/Expensify/expensify-common.git#6bd112f1e7ebbd6679042fa04060104b68beace2", "fbjs": "^3.0.2", "file-loader": "^6.0.0", "html-entities": "^1.3.1", diff --git a/src/CONST.js b/src/CONST.js index 8339852477766..935ce523f78dc 100755 --- a/src/CONST.js +++ b/src/CONST.js @@ -756,6 +756,7 @@ const CONST = { NON_NUMERIC: /\D/g, EMOJI_NAME: /:[\w+-]+:/g, EMOJI_SUGGESTIONS: /:[a-zA-Z]{1,20}(\s[a-zA-Z]{0,20})?$/, + AFTER_FIRST_LINE_BREAK: /\n.*/g, }, PRONOUNS: { diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index ba52c58a2772e..c7eba83e0b2a9 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -403,7 +403,9 @@ function canShowReportRecipientLocalTime(personalDetails, report) { * @returns {String} */ function formatReportLastMessageText(lastMessageText) { - return String(lastMessageText).substring(0, CONST.REPORT.LAST_MESSAGE_TEXT_MAX_LENGTH); + return String(lastMessageText) + .replace(CONST.REGEX.AFTER_FIRST_LINE_BREAK, '') + .substring(0, CONST.REPORT.LAST_MESSAGE_TEXT_MAX_LENGTH); } /** diff --git a/src/pages/home/report/ReportActionItemFragment.js b/src/pages/home/report/ReportActionItemFragment.js index 3d8fdb9c6e353..1be5c43e90dea 100644 --- a/src/pages/home/report/ReportActionItemFragment.js +++ b/src/pages/home/report/ReportActionItemFragment.js @@ -98,20 +98,15 @@ const ReportActionItemFragment = (props) => { ) ); } - let {html, text} = props.fragment; + const {html, text} = props.fragment; // If the only difference between fragment.text and fragment.html is
tags - // we replace them with line breaks and render it as text, not as html. + // we render it as text, not as html. // This is done to render emojis with line breaks between them as text. - const differByLineBreaksOnly = Str.replaceAll(props.fragment.html, '
', ' ') === props.fragment.text; - if (differByLineBreaksOnly) { - const textWithLineBreaks = Str.replaceAll(props.fragment.html, '
', '\n'); - html = textWithLineBreaks; - text = textWithLineBreaks; - } + const differByLineBreaksOnly = Str.replaceAll(html, '
', '\n') === text; // Only render HTML if we have html in the fragment - if (html !== text) { + if (!differByLineBreaksOnly) { const editedTag = props.fragment.isEdited ? '' : ''; const htmlContent = html + editedTag; return (