-
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
The app should take the user back to the profile page when the user clicks the back button in the web browser #28999
Conversation
@aimane-chnaif 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] |
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.
Also apply to other user profile avatars, workspace avatars
Screen.Recording.2023-10-08.at.5.19.47.PM.mov
src/components/AttachmentModal.js
Outdated
if (typeof props.onModalClose === 'function') { | ||
props.onModalClose(); | ||
} | ||
}, [props]); |
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.
Only onModalClose
prop is required for dependency, isn't it?
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.
@dukenv0307 can you answer here?
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.
React Hook useCallback has a missing dependency: 'props'. Either include it or remove the dependency array. However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the useCallback call and refer to those specific props inside useCallback
We can destructure props as alternative
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.
Yes you're right.
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.
@aimane-chnaif Updated the dependency.
@aimane-chnaif If we also apply change to these pages as mentioned in this comment, we have two options
|
I am fine either option. 2nd one seems better. |
Can you elaborate on what these new routes would look like? |
MODAL_PHOTO: {
route: 'modal/photo',
getRoute: (source: string) => `modal/photo?source=${source}`,
}, Then this route can be applied to all image modals including profile avatar, other users' profile avatar, workspace avatar along with any upcoming images |
I think it's fine to have separate routes. If any new type of preview is introduced in the future, we can add new route always. |
cc: @Expensify/design
|
Yeah separate routes seems fine for now 👍 |
Thanks @dukenv0307 is your code in good shape and ready for review? |
@dukenv0307 my feedback is not addressed yet. Let me know when ready for review |
@dukenv0307 bump ^. Also fix conflict. I see you're active on other issues |
@aimane-chnaif The PR is ready for review. |
Too slow to move forward step by step on this PR. |
@aimane-chnaif I'm available now, you can review the PR and I will update this. |
@aimane-chnaif We should display not found page in the attachment modal or return not found page on |
What's the difference? |
src/ROUTES.ts
Outdated
PROFILE_AVATAR: { | ||
route: 'profile/:accountID/avatar', | ||
getRoute: (accountID: string) => `profile/${accountID}/avatar`, | ||
}, | ||
|
||
WORKSPACE_AVATAR: { | ||
route: 'workspace/:policyID/avatar', | ||
getRoute: (policyID: string) => `workspace/${policyID}/avatar`, | ||
}, |
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 am concerned about these routes.
Everyone in the room should be able to see avatar no matter admin or member.
policyID
should be visible to only admins. We should use reportID
.
Let's update the routes like this:
- workspace:
r/6449050474229627/avatar
orr/6449050474229627/details/avatar
- user:
a/13040813/avatar
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.
@aimane-chnaif So what URL we will display when we click on view photo in WorkspaceSettingPage
?
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.
@aimane-chnaif So what URL we will display when we click on view photo in
WorkspaceSettingPage
?
I think we should open this back to discussion. Can you raise on slack?
http://localhost:8082/r/7392845470252151 - this is example public room where policy doesn't exist in Onyx and thus shows wrong avatar
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.
@aimane-chnaif Do you think we should add a new route for report avatar?
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.
So what URL we will display when we click on view photo in WorkspaceSettingPage?
And /workspace/:policyID/avatar
this will be the URL for this case.
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.
@aimane-chnaif Slack discussion here https://expensify.slack.com/archives/C01GTK53T8Q/p1697622739270509
Updated these case |
Let's hold this until we get confirmation about route definitions on slack |
@aimane-chnaif Update the PR after we confirmed in Slack. |
@aimane-chnaif Updated. |
src/components/AttachmentModal.js
Outdated
@@ -482,7 +519,6 @@ function AttachmentModal(props) { | |||
isWorkspaceAvatar={props.isWorkspaceAvatar} | |||
fallbackSource={props.fallbackSource} | |||
isUsedInAttachmentModal | |||
transactionID={props.transaction.transactionID} |
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.
Why was this removed?
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.
That is my mistake, updated.
Co-authored-by: Aimane Chnaif <96077027+aimane-chnaif@users.noreply.github.com>
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid.movAndroid: mWeb Chromemchrome.moviOS: Nativeios.moviOS: mWeb Safarimsafari.movMacOS: Chrome / Safariweb.movweb-back-button.movMacOS: Desktopdesktop.mov |
@dukenv0307 please add more test cases in QA Steps. All 3 pages (profile, workspace, report) |
@aimane-chnaif Updated test step and merged main. Wait for perf-test. |
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.
Okay tested it out a bit, it seems good 👍
✋ 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 production by https://github.com/thienlnam in version: 1.4.31-7 🚀
|
return ( | ||
<AttachmentModal | ||
// @ts-expect-error TODO: Remove this once AttachmentModal (https://github.com/Expensify/App/issues/25130) is migrated to TypeScript. | ||
headerTitle={personalDetail?.displayName ?? ''} |
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.
✋ Coming from #35514
The header title here will show empty on a hidden user. So we should use PersonalDetailsUtils.getDisplayNameOrDefault
to get the correct display name for such a condition.
function ReportAvatar({report = {} as Report, policies, isLoadingApp = true}: ReportAvatarProps) { | ||
const policy = policies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID ?? '0'}`]; | ||
const isArchivedRoom = ReportUtils.isArchivedRoom(report); | ||
const policyName = isArchivedRoom ? report?.oldPolicyName : policy?.name; |
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.
We should have used ReportUtils.getPolicyName(report, false, policy)
to get the policy name. This caused #35262
Details
When viewing the profile photo, the app should take the user back to the profile page when the user clicks the back button in the web browser
Fixed Issues
$ #27856
PROPOSAL: #27856 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.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)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label 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
Web
web.mov
Mobile Web - Chrome
chrome.mov
Mobile Web - Safari
safari.mov
Desktop
desktop.mov
iOS
ios.mov
Android
android.mov