Skip to content

Commit

Permalink
Merge pull request #27788 from lukemorawski/26773-bug-user_is_able_to…
Browse files Browse the repository at this point in the history
…_delete_default_contact_method

26773-bug-user_is_able_to_delete_default_contact_method
  • Loading branch information
amyevans authored Sep 29, 2023
2 parents 6093340 + d0cb155 commit 4ebeea0
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ class ContactMethodDetailsPage extends Component {
const isDefaultContactMethod = this.props.session.email === loginData.partnerUserID;
const hasMagicCodeBeenSent = lodashGet(this.props.loginList, [contactMethod, 'validateCodeSent'], false);
const isFailedAddContactMethod = Boolean(lodashGet(loginData, 'errorFields.addedLogin'));
const isFailedRemovedContactMethod = Boolean(lodashGet(loginData, 'errorFields.deletedLogin'));

return (
<ScreenWrapper
Expand All @@ -248,7 +249,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}
danger
/>
{isFailedAddContactMethod && (
Expand Down Expand Up @@ -289,9 +290,9 @@ class ContactMethodDetailsPage extends Component {
{isDefaultContactMethod ? (
<OfflineWithFeedback
pendingAction={lodashGet(loginData, 'pendingFields.defaultLogin', null)}
errors={ErrorUtils.getLatestErrorField(loginData, 'defaultLogin')}
errors={ErrorUtils.getLatestErrorField(loginData, isFailedRemovedContactMethod ? 'deletedLogin' : 'defaultLogin')}
errorRowStyles={[styles.ml8, styles.mr5]}
onClose={() => User.clearContactMethodErrors(contactMethod, 'defaultLogin')}
onClose={() => User.clearContactMethodErrors(contactMethod, isFailedRemovedContactMethod ? 'deletedLogin' : 'defaultLogin')}
>
<Text style={[styles.ph5, styles.mv3]}>{this.props.translate('contacts.yourDefaultContactMethod')}</Text>
</OfflineWithFeedback>
Expand Down

0 comments on commit 4ebeea0

Please sign in to comment.