Skip to content
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

Update search to work with chat rooms with empty participants + prevent searching for chat rooms by participant #43626

Merged
merged 44 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
30c08c8
allow displaying default rooms with empty participants when searching…
jasperhuangg Jun 12, 2024
e85e860
Merge branch 'main' of github.com:Expensify/App into jasper-defaultRo…
jasperhuangg Jun 17, 2024
72e3f6d
add comment
jasperhuangg Jun 17, 2024
76b6469
style
jasperhuangg Jun 17, 2024
57d3356
prevent rooms from getting filtered out during participantLogins/disp…
jasperhuangg Jun 17, 2024
932b8ce
style
jasperhuangg Jun 17, 2024
1464ba1
ensure chat rooms don't get filtered out in the front-end if they don…
jasperhuangg Jun 17, 2024
e8cae10
update comment
jasperhuangg Jun 17, 2024
acc477f
remove unused
jasperhuangg Jun 17, 2024
941748d
Merge branch 'main' of github.com:Expensify/App into jasper-defaultRo…
jasperhuangg Jun 21, 2024
978ad3b
prevent all chat rooms from being searchable by participant
jasperhuangg Jun 21, 2024
3e6b24e
Allow empty rooms to show up when searching
jasperhuangg Jun 21, 2024
6aebea1
remove debug logs
jasperhuangg Jun 24, 2024
d0fb81d
remove debug logs
jasperhuangg Jun 24, 2024
76f675d
update comment
jasperhuangg Jun 24, 2024
acb273f
merge conflicts
jasperhuangg Jun 25, 2024
a5b70cc
Flip searchable via participants conditions
jasperhuangg Jun 26, 2024
baad6f9
Add comment for confusing section
jasperhuangg Jun 26, 2024
0237f81
calculate isSearchingForReports from searchInputValue
jasperhuangg Jun 27, 2024
a842879
simplify logic and improve comment
jasperhuangg Jun 27, 2024
128a3ce
update comment
jasperhuangg Jun 27, 2024
dfead13
style
jasperhuangg Jun 28, 2024
01c993f
remove unused
jasperhuangg Jun 28, 2024
d42b35b
add back missing variable
jasperhuangg Jun 28, 2024
ecf4bfe
remove unused logic
jasperhuangg Jun 28, 2024
1835257
improve comment
jasperhuangg Jun 28, 2024
edcb7ef
remove unused comment
jasperhuangg Jun 28, 2024
131ae67
Use isChatRoom to decide whether to display reports with empty partic…
jasperhuangg Jun 28, 2024
a133dde
remove unused
jasperhuangg Jun 28, 2024
8e0ca90
remove unused
jasperhuangg Jun 28, 2024
09870fc
remove unused
jasperhuangg Jun 28, 2024
7c12483
simplify logic
jasperhuangg Jun 28, 2024
cae1a80
remove isSearchableViaParticipants
jasperhuangg Jun 28, 2024
a202b1e
remove unused
jasperhuangg Jun 28, 2024
88a6564
add missing hook dependency
jasperhuangg Jun 28, 2024
802a3d0
remove unused param
jasperhuangg Jun 28, 2024
9ca7cea
remove duplicate checks
jasperhuangg Jul 1, 2024
d1c6c00
condense logic and add comment
jasperhuangg Jul 1, 2024
9e4ab91
Merge branch 'main' of github.com:Expensify/App into jasper-defaultRo…
jasperhuangg Jul 1, 2024
f5dc4f7
remove unused
jasperhuangg Jul 1, 2024
f8352cb
Merge branch 'main' of github.com:Expensify/App into jasper-defaultRo…
jasperhuangg Jul 3, 2024
505e31a
consolidate logic
jasperhuangg Jul 3, 2024
86735ab
consolidate logic
jasperhuangg Jul 3, 2024
31d0194
fix merge conflicts
jasperhuangg Jul 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/libs/OptionsListUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2490,11 +2490,6 @@ function filterOptions(options: Options, searchInputValue: string, config?: Filt
values.push(item.login.replace(emailRegex, ''));
}

if (!item.isChatRoom) {
const participantNames = getParticipantNames(item.participantsList ?? []);
values = values.concat(Array.from(participantNames));
}

if (item.isThread) {
if (item.alternateText) {
values.push(item.alternateText);
Expand All @@ -2504,7 +2499,11 @@ function filterOptions(options: Options, searchInputValue: string, config?: Filt
if (item.subtitle) {
values.push(item.subtitle);
}
} else {
}

if (!item.isChatRoom) {
const participantNames = getParticipantNames(item.participantsList ?? []);
values = values.concat(Array.from(participantNames));
values = values.concat(getParticipantsLoginsArray(item));
jasperhuangg marked this conversation as resolved.
Show resolved Hide resolved
}

Expand Down
10 changes: 5 additions & 5 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ function isOpenInvoiceReport(report: OnyxEntry<Report>): boolean {
* Whether the provided report is a chat room
*/
function isChatRoom(report: OnyxEntry<Report>): boolean {
return isUserCreatedPolicyRoom(report) || isDefaultRoom(report) || isInvoiceRoom(report);
return isUserCreatedPolicyRoom(report) || isDefaultRoom(report) || isInvoiceRoom(report) || isTripRoom(report);
}

/**
Expand Down Expand Up @@ -5417,16 +5417,16 @@ function shouldReportBeInOptionList({
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
report?.isHidden ||
(!report?.participants &&
// We omit sending back participants for chat rooms when searching for reports since they aren't needed to display the results and can get very large.
// So we allow showing rooms with no participants–in any other circumstances we should never have these reports with no participants in Onyx.
!isChatRoom(report) &&
!isChatThread(report) &&
!isPublicRoom(report) &&
!isUserCreatedPolicyRoom(report) &&
!isArchivedRoom(report) &&
!isMoneyRequestReport(report) &&
!isTaskReport(report) &&
!isSelfDM(report) &&
!isSystemChat(report) &&
!isGroupChat(report) &&
!isInvoiceRoom(report))
!isGroupChat(report))
) {
return false;
}
Expand Down
Loading