Skip to content

Commit

Permalink
Merge pull request #3059 from parasharrajat/LHN-preview
Browse files Browse the repository at this point in the history
  • Loading branch information
deetergp authored Jun 1, 2021
2 parents 6b126e1 + 12cbca2 commit 6b7902f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ function getSimplifiedReportObject(report) {

// We are removing any html tags from the message html since we cannot access the text version of any comments as
// the report only has the raw reportActionList and not the processed version returned by Report_GetHistory
const lastMessageText = lodashGet(lastReportAction, ['message', 'html'], '').replace(/(<([^>]+)>)/gi, '');
// We convert the line-breaks in html to space ' ' before striping the tags
const lastMessageText = lodashGet(lastReportAction, ['message', 'html'], '')
.replace(/((<br[^>]*>)+)/gi, ' ')
.replace(/(<([^>]+)>)/gi, '');
const reportName = lodashGet(report, 'reportNameValuePairs.type') === 'chat'
? getChatReportName(report.sharedReportList)
: report.reportName;
Expand Down Expand Up @@ -973,7 +976,7 @@ function addAction(reportID, text, file) {

// Remove HTML from text when applying optimistic offline comment
const textForNewComment = isAttachment ? '[Attachment]'
: htmlForNewComment.replace(/<[^>]*>?/gm, '');
: htmlForNewComment.replace(/((<br[^>]*>)+)/gi, ' ').replace(/<[^>]*>?/gm, '');

// Update the report in Onyx to have the new sequence number
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {
Expand Down Expand Up @@ -1213,7 +1216,7 @@ function editReportComment(reportID, originalReportAction, htmlForNewComment) {
const actionToMerge = {};
newReportAction.message[0].isEdited = true;
newReportAction.message[0].html = htmlForNewComment;
newReportAction.message[0].text = Str.stripHTML(htmlForNewComment);
newReportAction.message[0].text = Str.stripHTML(htmlForNewComment.replace(/((<br[^>]*>)+)/gi, ' '));
actionToMerge[sequenceNumber] = newReportAction;
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, actionToMerge);

Expand Down

0 comments on commit 6b7902f

Please sign in to comment.