-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Decode transaction messages because they may have HTML Entities #15578
Conversation
@aimane-chnaif @thienlnam 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] |
|
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.
It appears to be working well for me. Additionally to testing with the UAH
currency that shows the bug, I tested with an account with html entities in the first name:
Without the fix, the &
s in the name were escaped:
With the fix, the name shows as it was original typed and the currency doesn't have
next to it anymore:
@aimane-chnaif are you around to the reviewer checklist? |
I asked @thienlnam as well |
Reviewer Checklist
Screenshots/Videos |
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.
Code changes look good, running through testing steps
@thienlnam do you want to divide the platforms? I can give you a hand with collecting the screenshots |
@aldo-expensify If you could please help with android and desktop that would be amazing! |
Provided desktop, ios native, android native |
Team work makes the dream work baby |
Oh I left a message in the issue, this was on purpose because a contributor was fixing the front-end here #15340. We warned a few bug reporters this morning about this but we didn't warn Applause, that was my fault 🤦♀️ |
Performance Comparison Report 📊Significant Changes To Duration
Show details
Meaningless Changes To DurationShow entries
Show details
|
@Expensify/mobile-deployers 📣 Please look into this performance regression as it's a deploy blocker. |
Decode transaction messages because they may have HTML Entities (cherry picked from commit c35f777)
…-15578 🍒 Cherry pick PR #15578 to staging 🍒
🚀 Cherry-picked to staging by https://github.com/aldo-expensify in version: 1.2.77-4 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
@yuwenmemon @aldo-expensify I think this will cause a regression. Anyway, the regression I think of is if the message is:
I don't think this is intended, is it? If not then the fix would be: Str.htmlDecode(new ExpensiMark().htmlToText(this.props.action.message[0].html)); |
Or we can just |
Tyler added a decode in the backend here: https://github.com/Expensify/Web-Expensify/pull/36642 (not deployed yet) Would be good to check if maybe that made this PR unnecessary. I may be able to do some testing later. |
@aldo-expensify I think it's added only for notifications, no? |
Hmm no, it was added to a function that converts the html to text for all cases I think. |
This was for all IOU cases, not only notifications, Tyler's PR doesn't cover IOU messages. I think our code was really messy in different parts and it wasn't consistent. Some actions would decode, other ones wouldn't, some front-end would encode, other parts wouldn't... |
ah cool, then it should cover IOU message as well, I don't think there is anything special about those. Let's wait for the PR to be deployed and test again, maybe this PR is not required after all |
@@ -76,7 +77,7 @@ class ReportTransaction extends Component { | |||
wrapperStyles={[styles.reportTransactionWrapper]} | |||
> | |||
<Text style={[styles.chatItemMessage]}> | |||
{this.props.action.message[0].text} | |||
{Str.htmlDecode(this.props.action.message[0].html)} |
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.
There might be case of html
not present in message.
For safety, how about fallback to text
like this?
{this.props.action.message[0].html ? Str.htmlDecode(this.props.action.message[0].html) : this.props.action.message[0].text}
🚀 Deployed to production by https://github.com/yuwenmemon in version: 1.2.77-4 🚀
|
🚀 Cherry-picked to staging by https://github.com/AndrewGable in version: 1.3.28-2 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
🚀 Deployed to production by https://github.com/AndrewGable in version: 1.3.28-5 🚀
|
@aldo-expensify please review
Details
We were original showing the text here, but now that the IOU message may contain encoded HTML entities after this PR: https://github.com/Expensify/Web-Expensify/pull/36598, we should be decoding them in the front-end.
Fixed Issues
$ #15576
Tests/QA Steps
nbsp;
or anything like that in the messages for the transactionsOffline tests
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)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
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android