-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Reports-Grouping options are highlighted although grouping isn't supported feature for chat messages #76338
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
@bernhardoj 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] |
| case CONST.SEARCH.SYNTAX_FILTER_KEYS.TAG: | ||
| return tagList.get().includes(range.value); | ||
| case CONST.SEARCH.SYNTAX_ROOT_KEYS.GROUP_BY: | ||
| if (currentType !== CONST.SEARCH.DATA_TYPES.EXPENSE && currentType !== CONST.SEARCH.DATA_TYPES.INVOICE) { |
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.
Logic Issue: Missing TRIP type in groupBy validation
The current validation only checks for EXPENSE and INVOICE types, but based on the getSections function in SearchUIUtils.ts (lines 1793-1817), the TRIP type also supports groupBy functionality.
Evidence from SearchUIUtils.ts:
- CHAT, TASK, and EXPENSE_REPORT return early (lines 1793-1801) and don't support groupBy
- Only after those checks, the code processes groupBy logic (lines 1804-1814)
- Therefore, EXPENSE, INVOICE, and TRIP all support groupBy
Suggested fix:
if (currentType !== CONST.SEARCH.DATA_TYPES.EXPENSE && currentType !== CONST.SEARCH.DATA_TYPES.INVOICE && currentType !== CONST.SEARCH.DATA_TYPES.TRIP) {
return false;
}This ensures groupBy highlighting is correctly allowed for all three types that actually support the feature.
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.
Hmm, from this code, we indeed support the group by filter for TRIP.
App/src/hooks/useAdvancedSearchFilters.ts
Lines 127 to 135 in fbed79d
| [CONST.SEARCH.DATA_TYPES.TRIP]: [ | |
| [ | |
| CONST.SEARCH.SYNTAX_FILTER_KEYS.TYPE, | |
| CONST.SEARCH.SYNTAX_FILTER_KEYS.FROM, | |
| CONST.SEARCH.SYNTAX_FILTER_KEYS.TO, | |
| CONST.SEARCH.SYNTAX_FILTER_KEYS.KEYWORD, | |
| CONST.SEARCH.SYNTAX_FILTER_KEYS.STATUS, | |
| CONST.SEARCH.SYNTAX_FILTER_KEYS.POLICY_ID, | |
| CONST.SEARCH.SYNTAX_ROOT_KEYS.GROUP_BY, |
And as the AI mentioned above in SearchUIUtils.ts, we allow TRIP to have group by filter.
Lines 1793 to 1807 in fbed79d
| if (type === CONST.SEARCH.DATA_TYPES.CHAT) { | |
| return getReportActionsSections(data); | |
| } | |
| if (type === CONST.SEARCH.DATA_TYPES.TASK) { | |
| return getTaskSections(data, formatPhoneNumber, archivedReportsIDList); | |
| } | |
| if (type === CONST.SEARCH.DATA_TYPES.EXPENSE_REPORT) { | |
| return getReportSections(data, currentSearch, currentAccountID, currentUserEmail, formatPhoneNumber, isActionLoadingSet, reportActions); | |
| } | |
| if (groupBy) { | |
| // Disabling the default-case lint rule here is actually safer as this forces us to make the switch cases exhaustive | |
| // eslint-disable-next-line default-case | |
| switch (groupBy) { |
CONST.SEARCH.DATA_TYPES includes CHAT, TASK, EXPENSE_REPORT, EXPENSE, INVOICE, TRIP.
But we only show the group by suggestion for EXPENSE and INVOICE.
App/src/components/Search/SearchAutocompleteList.tsx
Lines 219 to 224 in fbed79d
| const groupByAutocompleteList = (() => { | |
| switch (currentType) { | |
| case CONST.SEARCH.DATA_TYPES.EXPENSE: | |
| case CONST.SEARCH.DATA_TYPES.INVOICE: | |
| return Object.values(CONST.SEARCH.GROUP_BY).map((value) => getUserFriendlyValue(value)); | |
| default: |
@robertjchen should we highlight it for TRIP, too?
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.
I don't see downsides for doing so, I think we can allow it 👍
Reviewer Checklist
Screenshots/Videos |





Explanation of Change
Fixed Issues
$ #75411
PROPOSAL: #75411 (comment)
Tests
Offline tests
QA Steps
Same as Tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
ANDROID.mov
Android: mWeb Chrome
WEBSITE.ANDROID.mov
iOS: Native
IOS.mov
iOS: mWeb Safari
WEBSITE.IOS.mov
MacOS: Chrome / Safari
WEBSITE.mov