-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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 go back from flag comment page to report #30289
fix go back from flag comment page to report #30289
Conversation
@mananjadhav 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] |
@mananjadhav Please help me review this PR thanks |
@suneox I was testing this and it looks like for Web we're reloading the report because of this change. Behavior after our change. Notice the report reloads. web-back-button-press-flag-as-offensive.movBehavior on staging and main staging-back-button-press-flag-as-offensive.mov |
@mananjadhav It only happens on mobile browser, could you please check it again on mobile? |
Ah I saw a difference for transition so should we only check for Browser mobile by 'Browser.isMobile()' |
Hi @mananjadhav this issue only happens on mobile browsers so I have added a condition check is Browser mobile at 30101-go-back-from-web.mp4 |
@mananjadhav could you please checkout current change and verify? |
@mananjadhav do you still work on this ticket? |
Hi @mananjadhav as a confirmed with this approach so could you please review this PR? Thanks! |
…rom-flag-as-offensive-page
src/pages/FlagCommentPage.js
Outdated
<HeaderWithBackButton | ||
title={props.translate('reportActionContextMenu.flagAsOffensive')} | ||
onBackButtonPress={() => { | ||
const topMostReportID = Navigation.getTopmostReportId(); |
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.
@suneox I can see this is exactly same as ReportDetailsPage
. Why not move this to a util? so that we can use it again?
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 think we should add props link shouldAwareTopMostReport
default is false
into HeaderWithBackButton
and move logic
const topMostReportID = Navigation.getTopmostReportId();
if (topMostReportID) {
Navigation.goBack(ROUTES.HOME);
return;
}
before onBackButtonPress
callback
Change current to
<PressableWithoutFeedback
onPress={() => {
if (isKeyboardShown) {
Keyboard.dismiss();
}
const topMostReportID = Navigation.getTopmostReportId();
if (shouldAwareTopMostReport && topMostReportID) {
Navigation.goBack(ROUTES.HOME);
} else {
onBackButtonPress();
}
}}
Then add props shouldAwareTopMostReport
to ReportDetailsPage
and FlagCommentPage
@mananjadhav What do you think about 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.
Can we modify the condition so that topMostReportID
is fetched only if shouldAwareTopMostReport
is set true?
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 so the condition look like this if (shouldAwareTopMostReport && Navigation.getTopmostReportId())
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 have updated the condition and synced it with the latest main
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.
@mananjadhav i have updated condition before get topMostReportID
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid-flag-as-offensive-go-back.movAndroid: mWeb Chromemweb-chrome-flag-as-offensive-go-back.moviOS: Nativeios-flag-as-offensive-go-back.moviOS: mWeb Safarimweb-safari-flag-as-offensive-go-back.movMacOS: Chrome / Safariweb-flag-as-offensive-go-back.movMacOS: Desktopdesktop-flag-as-offensive-go-back.movTests well, waiting for the refactor to make the logic as a DRY code. |
@mananjadhav i have updated PR to resolve DRY code, have you got any feedback? |
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.
The change looks good to me. I'll have it tested in a while.
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.
Retested this. Thanks for addressing the changes.
@@ -93,6 +93,9 @@ const propTypes = { | |||
|
|||
/** Single execution function to prevent concurrent navigation actions */ | |||
singleExecution: PropTypes.func, | |||
|
|||
/** Whether we should navigate to home when the route have a topMostReport */ | |||
shouldAwareTopMostReport: PropTypes.bool, |
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.
This name is not great, why not navigateToTopMostReport
?
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, isn't this really navigating to home and not to the topmost report?
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 have updated prop name
Also, isn't this really navigating to home and not to the topmost report?
Because the home page has loaded topmost report so when we navigate to home the report is also already but to avoid confusion for this case I have updated the function to navigate the report page with topMostReportId.
✋ 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/mountiny in version: 1.4.5-7 🚀
|
Details
Fixed Issues
$ #30101
PROPOSAL: #30101 (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)/** comment above it */
this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)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
30101-android-native.mp4
Android: mWeb Chrome
30101-android-chrome.mp4
iOS: Native
30101-ios-native.MP4
iOS: mWeb Safari
30101-ios-safari.mp4
MacOS: Chrome / Safari
30101-mac-mSafari.mp4
30101-mac-mChrome.mp4
MacOS: Desktop
30101-mac-desktop.mp4