-
Notifications
You must be signed in to change notification settings - Fork 3k
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
26773-bug-user_is_able_to_delete_default_contact_method #27788
26773-bug-user_is_able_to_delete_default_contact_method #27788
Conversation
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.
LGTM, left a comment.
src/pages/settings/Profile/Contacts/ContactMethodDetailsPage.js
Outdated
Show resolved
Hide resolved
src/pages/settings/Profile/Contacts/ContactMethodDetailsPage.js
Outdated
Show resolved
Hide resolved
Co-authored-by: Michael (Mykhailo) Kravchenko <rezkiy37@gmail.com>
> | ||
<Text style={[styles.ph5, styles.mv3]}>{this.props.translate('contacts.yourDefaultContactMethod')}</Text> | ||
</OfflineWithFeedback> | ||
{isFailedRemovedContactMethod && ( |
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 would remove this conditional rendering and wrap the OfflineWithFeedback above with this. Because the error will only be shown if ErrorUtils.getLatestErrorField(loginData, 'deletedLogin')
returns an error, and it's the same as doing lodashGet(loginData, 'errorFields.deletedLogin')
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.
not sure if I follow your logic, but I think I have found a slightly better way of dealing with this conundrum.
{isDefaultContactMethod ? (
<OfflineWithFeedback
pendingAction={lodashGet(loginData, 'pendingFields.defaultLogin', null)}
errors={ErrorUtils.getLatestErrorField(loginData, isFailedRemovedContactMethod ? 'deletedLogin' : 'defaultLogin')}
errorRowStyles={[styles.ml8, styles.mr5]}
onClose={() => User.clearContactMethodErrors(contactMethod, isFailedRemovedContactMethod ? 'deletedLogin' : 'defaultLogin')}
>
<Text style={[styles.ph5, styles.mv3]}>{this.props.translate('contacts.yourDefaultContactMethod')}</Text>
</OfflineWithFeedback>
) : (
...
)}
@Ollyws Hey! Any update on this? |
testing/reviewing at the moment. |
@@ -245,7 +246,7 @@ class ContactMethodDetailsPage extends Component { | |||
prompt={this.props.translate('contacts.removeAreYouSure')} | |||
confirmText={this.props.translate('common.yesContinue')} | |||
cancelText={this.props.translate('common.cancel')} | |||
isVisible={this.state.isDeleteModalOpen} | |||
isVisible={this.state.isDeleteModalOpen && !isDefaultContactMethod} |
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.
An issue with using isDefaultContactMethod
is that this is only updated when the server response is recieved, is there any way we can hide the modal using optimisticData so it responds immediately when the contact method is deleted? I was in some cases able to successfully delete the second contact method by clicking the confirm button before it was hidden.
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'll see what I can do :)
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.
Looks like it's the only thing we can do right now. The app cannot use any optimistic approach here, as the contact method is being set to default on a different device. There is no way to know if the method status was changed, other then to wait for the update from the backend. That's why this PR has the additional error handling added (using optimistic update approach). If you delete the contact before themodal was hidden, but on the BE it was already flagged as default, you will receive and error (the red brick road indicators) so you'll know what nothing has changed.
Sorry, but that's how this works :)
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.
Ah ok no worries, I just meant when the user was using two tabs in the same browser but it's a pretty edge case scenario. Current behaviour is acceptable, thanks for looking anyway!
Reviewer Checklist
Screenshots/VideosWebMacOS_Chrome.mp4Mobile Web - ChromeAndroid_Chrome.mp4Mobile Web - SafariiOS_Safari.mp4DesktopMacOS_Desktop.mp4iOSiOS_Native.mp4AndroidAndroid_Native.mp4 |
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.
LGTM
We did not find an internal engineer to review this PR, trying to assign a random engineer to #26773 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
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.
Looks 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 staging by https://github.com/amyevans in version: 1.3.76-0 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.3.76-6 🚀
|
🚀 Deployed to staging by https://github.com/amyevans in version: 1.3.77-0 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.3.77-7 🚀
|
Details
The PR addresses the issue in two ways:
Fixed Issues
$ #26773
PROPOSAL: no proposal
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
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)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
Web
web.desktop.mov
Mobile Web - Chrome
Mobile Web - Safari
Desktop
web.desktop.mov
iOS
Android