-
Notifications
You must be signed in to change notification settings - Fork 81
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: Update error messages when adding user to library [FC-0062] #1543
fix: Update error messages when adding user to library [FC-0062] #1543
Conversation
Thanks for the pull request, @ChrisChV! What's next?Please work through the following steps to get your changes ready for engineering review: 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. 🔘 Let us know that your PR is ready for review:Who will review my changes?This repository is currently maintained by Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:
When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1543 +/- ##
==========================================
+ Coverage 92.91% 92.94% +0.03%
==========================================
Files 1071 1073 +2
Lines 21038 21095 +57
Branches 4538 4477 -61
==========================================
+ Hits 19547 19607 +60
- Misses 1418 1422 +4
+ Partials 73 66 -7 ☔ View full report in Codecov by Sentry. |
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 👍
Thank you for your work, @ChrisChV!
- I tested this using the instructions from the PR
- I read through the code
- I checked for accessibility issues
- Includes documentation
A minor issue with capitalization (not directly related to this code).
We are changing the string case inside the Toast and rendering it wrong.
<span className="font-weight-bold h4 mb-0 text-white">{capitalize(title)}</span> |
I think we should not do it. What do you think?
}); | ||
|
||
expect(await screen.findByText( | ||
'Error adding team member. please verify that the email is correct and belongs to a registered user.', |
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.
'Error adding team member. please verify that the email is correct and belongs to a registered user.', | |
'Error adding team member. Please verify that the email is correct and belongs to a registered user.', |
But this will only work if we fix the issue in the ProcessingNotification
component.
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 not do it. What do you think?
It is very restrictive and should allow placing a non-capitalized message, at least in the ToasContext.
I added that feature here: d1cedaf
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 make it simpler and just remove the capitalize
call. If it is needed somewhere, we can call it outside the component.
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 don't think our Toast
/ToastContext
/showToast
should ever be changing the capitalization of the message. Why is it doing that now?
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 guess we maybe? need to leave the behavior as an option in ProcessingNotification
but for ToastContext
it should not be an option. Just always disable capitalization, and remove the new parameter.
Or if you think we can remove it altogether as @rpenido suggested, that's even better!
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 removed the capitalization at all! I think it doesn't break anything: d92ea86
const errorData = addMemberError.response.data; | ||
if ('email' in errorData) { |
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 code is fragile, if a non-Axios error is raised:
Try something like:
const errorData = addMemberError.response.data; | |
if ('email' in errorData) { | |
const errorData = typeof addMemberError === 'object' ? addMemberError.response?.data : undefined; | |
if (errorData && 'email' in errorData) { |
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.
Updated bb90f0b
src/generic/toast-context/index.tsx
Outdated
@@ -10,7 +10,8 @@ export interface ToastActionData { | |||
export interface ToastContextData { | |||
toastMessage: string | null; | |||
toastAction?: ToastActionData; | |||
showToast: (message: string, action?: ToastActionData) => void; | |||
capitilize?: boolean; |
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.
What is the purpose of this new parameter? I don't think "capitalization" should be a feature of our toasts. Do we really need it?
Also, the spelling is wrong in several places. It should be "Capitalize" with two As.
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.
Removed here d92ea86
@bradenmacdonald It's ready for another review |
…nedx#1543) Updates the message error when the user doesn't exist when adding a new team member to a library.
) (#1550) Updates the message error when the user doesn't exist when adding a new team member to a library.
Description
Supporting information
Testing instructions
Manage Access
, and add a user that doesn't exist.