-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
align lastMessageText formatting with backend by trimming leading and trailing spaces #18822
Conversation
by trimming leading and trailing spaces
@robertjchen @rushatgabhane One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
@@ -158,7 +158,7 @@ function getLastVisibleMessageText(reportID, actionsToMerge = {}) { | |||
const htmlText = lodashGet(lastVisibleAction, 'message[0].html', ''); | |||
const parser = new ExpensiMark(); | |||
const messageText = parser.htmlToText(htmlText); | |||
return String(messageText).replace(CONST.REGEX.AFTER_FIRST_LINE_BREAK, '').substring(0, CONST.REPORT.LAST_MESSAGE_TEXT_MAX_LENGTH); | |||
return String(messageText).replace(CONST.REGEX.AFTER_FIRST_LINE_BREAK, '').substring(0, CONST.REPORT.LAST_MESSAGE_TEXT_MAX_LENGTH).trim(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we are not reusing ReportUtils.formatReportLastMessage because currently ReportUtils
is importing ReportActionsUtils
. We cannot import ReportUtils
functions into ReportActionsUtils
, otherwise there will be a cyclic dependency between the two utility libraries.
This was the decision from a separate PR https://github.com/Expensify/App/pull/14779/files#r1098049449
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, that's helpful!
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-05-16.at.01.29.57.movDesktopScreen.Recording.2023-05-16.at.01.39.23.moviOSScreen.Recording.2023-05-16.at.01.34.42.movAndroidScreen.Recording.2023-05-16.at.01.31.50.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@robertjchen LGTM!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! 👍
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/robertjchen in version: 1.3.15-0 🚀
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 1.3.15-12 🚀
|
* @param {String} lastMessageText | ||
* @returns {String} | ||
*/ | ||
function formatReportLastMessageText(lastMessageText) { | ||
return String(lastMessageText).replace(CONST.REGEX.AFTER_FIRST_LINE_BREAK, '').substring(0, CONST.REPORT.LAST_MESSAGE_TEXT_MAX_LENGTH); | ||
return Str.htmlDecode(String(lastMessageText)).replace(CONST.REGEX.AFTER_FIRST_LINE_BREAK, '').substring(0, CONST.REPORT.LAST_MESSAGE_TEXT_MAX_LENGTH).trim(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a note for future reference, we should never decode a plain text. A plain text is a raw text and not html, there is nothing to decode here.
For historic reasons we used to decode those due to another bug in Expensify-Common. We fixed that bug here #17658.
@robertjchen @rushatgabhane this PR is ready, appreciate your review.
The bug reported can be reproduced in MacOS web browser and Desktop app, but not on mobile as the LHN is not displayed along with the report chat in mobile, but I have includes video recordings for all platforms for completeness.
Details
Align formatting of lastMessageText formatting with backend by trimming the text in construction of optimistic report, so that there will be no difference between the text which get displayed immediate in LHN and the text received by Pusher event, covering add new comment, edit existing, and delete comment scenarios.
Fixed Issues
$ #17896
PROPOSAL: #17896 (comment)
Tests
message 1
message 2
message 2 edited
Offline tests
N/A
QA Steps
message 1
message 2
message 2 edited
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
Screen.Recording.2023-05-12.at.11.57.40.AM.mov
Mobile Web - Chrome
Screen.Recording.2023-05-12.at.2.44.50.PM.mov
Mobile Web - Safari
Screen.Recording.2023-05-12.at.2.50.47.PM.mov
Desktop
Screen.Recording.2023-05-12.at.11.52.03.AM.mov
iOS
Screen.Recording.2023-05-12.at.2.36.37.PM.mov
Android
Screen.Recording.2023-05-12.at.2.40.58.PM.mov