-
Notifications
You must be signed in to change notification settings - Fork 88
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
Merged
ChrisChV
merged 5 commits into
openedx:master
from
open-craft:chris/FAL-3978-update-team-member-error-msg
Dec 6, 2024
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2f40d67
fix: Update error messages when adding user to library
ChrisChV d59f0a8
test: Add test to fix coverage
ChrisChV d1cedaf
feat: Add disableCapitalize in ProcessingNotification
ChrisChV d92ea86
refactor: Remove capitalize in ProcessingNotification
ChrisChV bb90f0b
style: Some nits on the code
ChrisChV File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -65,8 +65,13 @@ const LibraryTeam: React.FC<Record<never, never>> = () => { | |||||||||
accessLevel: LibraryRole.Reader.toString() as LibraryAccessLevel, | ||||||||||
}).then(() => { | ||||||||||
showToast(intl.formatMessage(messages.addMemberSuccess)); | ||||||||||
}).catch(() => { | ||||||||||
showToast(intl.formatMessage(messages.addMemberError)); | ||||||||||
}).catch((addMemberError) => { | ||||||||||
const errorData = addMemberError.response.data; | ||||||||||
if ('email' in errorData) { | ||||||||||
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. This code is fragile, if a non-Axios error is raised: Try something like:
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. Updated bb90f0b |
||||||||||
showToast(intl.formatMessage(messages.addMemberEmailError)); | ||||||||||
} else { | ||||||||||
showToast(intl.formatMessage(messages.addMemberError)); | ||||||||||
} | ||||||||||
}); | ||||||||||
closeAddLibraryTeamMember(); | ||||||||||
}, | ||||||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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.
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 forToastContext
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