-
Notifications
You must be signed in to change notification settings - Fork 298
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
farrah/78916/refactor InvalidVerificationLinkModal #7017
Changes from all commits
25c75f4
14de1d0
61f02b8
34a7701
e3f3b14
e9678f4
86db5d4
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 | ||||
---|---|---|---|---|---|---|
|
@@ -53,7 +53,6 @@ export default class OrderStore { | |||||
setErrorMessage: action.bound, | ||||||
setHasMoreItemsToLoad: action.bound, | ||||||
setIsEmailLinkBlockedModalOpen: action.bound, | ||||||
setIsInvalidVerificationLinkModalOpen: action.bound, | ||||||
setIsLoading: action.bound, | ||||||
setIsLoadingModalOpen: action.bound, | ||||||
setIsRatingModalOpen: action.bound, | ||||||
|
@@ -140,15 +139,14 @@ export default class OrderStore { | |||||
response?.error.code === api_error_codes.INVALID_VERIFICATION_TOKEN || | ||||||
response?.error.code === api_error_codes.EXCESSIVE_VERIFICATION_REQUESTS | ||||||
) { | ||||||
clearTimeout(wait); | ||||||
// TODO: remove this once refactoring of EmailLinkVerifiedModal is done | ||||||
this.root_store.general_store.hideModal(); | ||||||
this.setVerificationLinkErrorMessage(response.error.message); | ||||||
const wait = setTimeout(() => this.setIsInvalidVerificationLinkModalOpen(true), 230); | ||||||
this.root_store.general_store.showModal({ | ||||||
key: 'InvalidVerificationLinkModal', | ||||||
props: { error_message: response.error.message, order_id: id }, | ||||||
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.
Suggested change
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. we are already checking response on line 138 |
||||||
}); | ||||||
} else if (response?.error.code === api_error_codes.EXCESSIVE_VERIFICATION_FAILURES) { | ||||||
if (this.is_invalid_verification_link_modal_open) { | ||||||
this.setIsInvalidVerificationLinkModalOpen(false); | ||||||
} | ||||||
clearTimeout(wait); | ||||||
this.setVerificationLinkErrorMessage(response.error.message); | ||||||
const wait = setTimeout(() => this.setIsEmailLinkBlockedModalOpen(true), 230); | ||||||
|
@@ -466,10 +464,12 @@ export default class OrderStore { | |||||
} | ||||||
|
||||||
verifyEmailVerificationCode(verification_action, verification_code) { | ||||||
const order_id = this.order_id; | ||||||
|
||||||
if (verification_action === 'p2p_order_confirm' && verification_code) { | ||||||
requestWS({ | ||||||
p2p_order_confirm: 1, | ||||||
id: this.order_id, | ||||||
id: order_id, | ||||||
verification_code, | ||||||
dry_run: 1, | ||||||
}).then(response => { | ||||||
|
@@ -485,13 +485,11 @@ export default class OrderStore { | |||||
response.error.code === api_error_codes.INVALID_VERIFICATION_TOKEN || | ||||||
response.error.code === api_error_codes.EXCESSIVE_VERIFICATION_REQUESTS | ||||||
) { | ||||||
clearTimeout(wait); | ||||||
this.setVerificationLinkErrorMessage(response.error.message); | ||||||
const wait = setTimeout(() => this.setIsInvalidVerificationLinkModalOpen(true), 750); | ||||||
this.root_store.general_store.showModal({ | ||||||
key: 'InvalidVerificationLinkModal', | ||||||
props: { error_message: response.error.message, order_id }, | ||||||
}); | ||||||
} else if (response.error.code === api_error_codes.EXCESSIVE_VERIFICATION_FAILURES) { | ||||||
if (this.is_invalid_verification_link_modal_open) { | ||||||
this.setIsInvalidVerificationLinkModalOpen(false); | ||||||
} | ||||||
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. Is it possible to handle this by getting the modal key from modal manager, checking against it and only hiding the modal if it is the 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. I believe there's no need to pass the modal key when hiding since we are showing and hiding modals one at a time. |
||||||
clearTimeout(wait); | ||||||
this.setVerificationLinkErrorMessage(response.error.message); | ||||||
const wait = setTimeout(() => this.setIsEmailLinkBlockedModalOpen(true), 600); | ||||||
|
@@ -538,10 +536,6 @@ export default class OrderStore { | |||||
this.is_email_link_blocked_modal_open = is_email_link_blocked_modal_open; | ||||||
} | ||||||
|
||||||
setIsInvalidVerificationLinkModalOpen(is_invalid_verification_link_modal_open) { | ||||||
this.is_invalid_verification_link_modal_open = is_invalid_verification_link_modal_open; | ||||||
} | ||||||
|
||||||
setIsLoading(is_loading) { | ||||||
this.is_loading = is_loading; | ||||||
} | ||||||
|
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.
Same as this, should we refactor out modal props that receive handlers? Since it might affect reusability if other pages has different ways to handle the onClick events
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.
Good point. But i think for now we can since this modal is specific to orders only.