-
Notifications
You must be signed in to change notification settings - Fork 4k
Add search this user/agent to ProfilePage #98091
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?
Changes from all commits
2acb427
fba18f7
ab5ee83
6ce6fcf
c967bf1
bbe7c43
3ef3680
6515343
0349534
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,6 +35,8 @@ import { | |
| isHiddenForCurrentUser as isReportHiddenForCurrentUser, | ||
| navigateToPrivateNotes, | ||
| } from '@libs/ReportUtils'; | ||
| import {buildQueryStringFromFilterFormValues} from '@libs/SearchQueryUtils'; | ||
| import {isAgentEmail} from '@libs/SessionUtils'; | ||
| import {generateAccountID} from '@libs/UserUtils'; | ||
| import {isValidAccountRoute} from '@libs/ValidationUtils'; | ||
|
|
||
|
|
@@ -92,7 +94,7 @@ function ProfilePage({route}: ProfilePageProps) { | |
| const [guidedSetupAndTourStatus] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {selector: guidedSetupAndTourStatusSelector}); | ||
| const switchToDelegator = useSwitchToDelegator(); | ||
| const guideCalendarLink = account?.guideDetails?.calendarLink ?? ''; | ||
| const expensifyIcons = useMemoizedLazyExpensifyIcons(['Bug', 'Pencil', 'Phone', 'UserPlus']); | ||
| const expensifyIcons = useMemoizedLazyExpensifyIcons(['Bug', 'MagnifyingGlass', 'Pencil', 'Phone', 'UserPlus']); | ||
| const accountID = Number(route.params?.accountID ?? CONST.DEFAULT_NUMBER_ID); | ||
| const [agentPrompt] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_AGENT_PROMPT}${accountID}`); | ||
| const isCurrentUser = currentUserAccountID === accountID; | ||
|
|
@@ -283,6 +285,18 @@ function ProfilePage({route}: ProfilePageProps) { | |
| ) : null} | ||
| {shouldShowLocalTime && <AutoUpdateTime timezone={timezone} />} | ||
| </View> | ||
| {shouldShowNotificationPreference && ( | ||
| <View style={[styles.w100, styles.detailsPageSectionContainer]}> | ||
| <MenuItemWithTopDescription | ||
| shouldShowRightIcon | ||
| title={notificationPreference} | ||
| description={translate('notificationPreferencesPage.label')} | ||
| onPress={() => { | ||
| Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.NOTIFICATION_PREFERENCES.getRoute(report.reportID))); | ||
| }} | ||
| /> | ||
| </View> | ||
| )} | ||
|
hungvu193 marked this conversation as resolved.
|
||
| {isCurrentUser && ( | ||
| <MenuItem | ||
| shouldShowRightIcon | ||
|
|
@@ -312,13 +326,17 @@ function ProfilePage({route}: ProfilePageProps) { | |
| onPress={callFunctionIfActionIsAllowed(() => switchToDelegator(login))} | ||
| /> | ||
| )} | ||
| {shouldShowNotificationPreference && ( | ||
| <MenuItemWithTopDescription | ||
| {!!accountID && !isAnonymousUserSession() && !!login && ( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This also renders on the current user's own profile. There's no F1.mov
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cc @quinthar
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @hungvu193, this is still not clear is it?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is expected
hungvu193 marked this conversation as resolved.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing test — the This guard has three Please add a test in it('hides the search entry when the profile has no login', async () => {
// seed personalDetails[123] WITHOUT a login → login resolves to ''
// render, then:
expect(screen.queryByText('View user history')).not.toBeOnTheScreen();
expect(screen.queryByText('View agent history')).not.toBeOnTheScreen();
});
hungvu193 marked this conversation as resolved.
|
||
| <MenuItem | ||
| shouldShowRightIcon | ||
| title={notificationPreference} | ||
| description={translate('notificationPreferencesPage.label')} | ||
| title={translate(isAgentEmail(login) ? 'profilePage.searchThisAgent' : 'profilePage.searchThisUser')} | ||
|
hungvu193 marked this conversation as resolved.
|
||
| icon={expensifyIcons.MagnifyingGlass} | ||
| onPress={() => { | ||
| Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.NOTIFICATION_PREFERENCES.getRoute(report.reportID))); | ||
| const query = buildQueryStringFromFilterFormValues({ | ||
| type: CONST.SEARCH.DATA_TYPES.CHAT, | ||
| from: [String(accountID)], | ||
| }); | ||
| Navigation.navigate(ROUTES.SEARCH_ROOT.getRoute({query})); | ||
|
Comment on lines
+335
to
+339
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Low Consistency question Other Search entry points pass both Here only |
||
| }} | ||
| /> | ||
| )} | ||
|
|
||
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.
NAB: Key name doesn't match the copy (naming nit, not a STYLE.md blocker)
These keys are named
searchThisUser/searchThisAgent, but the value in every locale reads "View … history" (e.g.de.ts:'Nutzerverlauf anzeigen',es.ts:'Ver historial del usuario'). The naming is at least consistent across all 11 locale files, so it's purely cosmetic — but anyone grepping for the "search" copy won't find it, and vice-versa.MY Suggestion
viewUserHistory/viewAgentHistory(matches the copy