-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Fix: Report- The search doesn't work if display name of user has Double quotes #58072
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
Fix: Report- The search doesn't work if display name of user has Double quotes #58072
Conversation
…pport the presence of nested double quotes within quoted strings, to fix name highlighting, and a broken search feature when a user's name has double quotes within it.
@dukenv0307 Please 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] |
All contributors have signed the CLA ✍️ ✅ |
@codekane Please resolve the conflicts |
And complete the checklist as well |
I have read the CLA Document and I hereby sign the CLA |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2025-03-12.at.11.31.48.movAndroid: mWeb ChromeScreen.Recording.2025-03-12.at.11.29.32.moviOS: NativeScreen.Recording.2025-03-12.at.11.30.37.moviOS: mWeb SafariScreen.Recording.2025-03-12.at.11.24.25.movMacOS: Chrome / SafariScreen.Recording.2025-03-12.at.11.13.46.movMacOS: DesktopScreen.Recording.2025-03-12.at.11.36.49.mov |
@codekane Code looks good and tests well. Can you please add some tests to cover this case? Thanks |
@codekane any updates? |
I've got failing tests regarding handling of the atypical double quotes. I'll update you once it's resolved. |
…e-double-quotes-in-quoted-strings
@codekane Is it ready for review? |
Yes. |
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.
LGTM
We did not find an internal engineer to review this PR, trying to assign a random engineer to #57086 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
Just confirming in Slack (internal only) that this is a feature we want to support. |
@rafecolton any updates? |
No response in Slack, thanks for the bump. @luacmartins what do you think of this change? |
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.
@codekane regex changes lgtm, but you also have to regenerate the search parser by running npm run generate-search-parser
.
…individual parser, due to divergent functionalities and requirements.
It's been done. Doing so broke some tests, so I've reverted the search parser to use the original version of the rule, and given the autocomplete parser the updated one. |
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.
Nice, looking much better. Left a few small comments on style
… the end of filese.
@luacmartins Got it - changes have been pushed. |
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.
@codekane sorry, one final style change request. Rest looks good to me
@luacmartins Done. I found a few other places these fixes could be applied as well. |
@codekane we have some checks failing |
@luacmartins SHOULD be resolved.
Ran ESLint. It returned successfully, so I'm guessing it was flagging on the same thing as Prettier. |
…t's used in the autocompleteParser (and pass the esLint check).
Updated: I fixed the imports in the SearchParserTest. esLint check should now pass. |
@luacmartins I see that there are failing checks... For files I didn't actually touch. I get that, if I touch it, and there are things failing the current checks in the file I've touched, that I'll pick that up. But I want to clarify to what extent my responsibility extends here. |
@codekane ESLint is still failing. Please check that the checks are passing locally by running:
|
@codekane sorry, I missed your previous message. I agree that the failure is on an unrelated file, so I don't think we need to fix that as part of this PR. Can you just merge main in this case though? Hopefully the issue was already fixed on main. |
…e-double-quotes-in-quoted-strings
@luacmartins - Done... Fingers Crossed. Although I appreciate the commands to run to do so locally - that'll save me time in the future, rather than going through this process over days. |
@rafecolton all yours |
✋ 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/rafecolton in version: 9.1.23-1 🚀
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.1.23-7 🚀
|
This is the solution for Issue 57086
Explanation of Change
I've modified the parser, used in the AutocompleteInput on the search bar of the reports feature to support the presence of nested double quotes within quoted strings, to fix name highlighting, and a broken search feature when a user's name has double quotes within it.
Previously, the parser would prematurely closet the string upon encountering a double quote. My solution resolves this by adding a set of rules that indicate the presence of an actual closing quote, and consider any other quotes encountered to instead be a part of the string.
As a fallback, it also looks for the lack of an operator before the end of the line. This rule ensures that existing functional continues to perform as expected, while handling the cases with nested double quotes flawlessly.
Fixed Issues
$ #57086
$ PROPOSAL: #57086 (comment)
Tests
The expected functionality is for everything to work exactly the same as it does on production - in terms of how this input "feels" to use. The only difference is that if either the from: or to: keys are set to a user who has double quotes in their name, it works successfully, instead of failing to correctly highlight them, and then failing to correctly parse them when you actually execute the search (due to inadequacies within the parser).
Offline tests
If you've already been online, and engaged in a search, and thus populated the datasets, this feature continues to work when offline. The search may, or may not work - it's ultimately dependant on whether that data is retained from when you were online.
QA Steps
To reproduce the bug as it stands, log in to Staging/Production, and perform the same steps.
What you'll find is that, when a double quote is present in the username, the highlighting does not work correctly and the search is non-functional, indicating an error in parsing the strings.
You'll know that the solution works, because this aberrant behaviour is no longer present, after the changes I've made.
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.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
Android: Native
Android.Native.Report.Double.Quote.Search.Bug.mp4
Android: mWeb Chrome
Android.Chrome.Report.Double.Quote.Search.Bug.mp4
iOS: Native
iOS.Native.-.Simulator.Screen.Recording.-.iPhone.16.Pro.-.2025-03-10.at.12.38.40.mp4
iOS: mWeb Safari
iOS.mWeb.-.Report.Doubel.Quote.Search.Bug.mp4
MacOS: Chrome / Safari
MacOS: Desktop