-
Notifications
You must be signed in to change notification settings - Fork 51
Hotifx - disable alphanumeric characters in challenge title #1665
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
Conversation
PM-1270 Exclude cancelled and completed projects from copilot request creation
This reverts commit a2ec0d9.
const ChallengeNameField = ({ challenge, onUpdateInput }) => { | ||
const handleChange = (e) => { | ||
// Remove any characters that are NOT letters, numbers, or spaces | ||
const sanitizedValue = e.target.value.replace(/[^a-zA-Z0-9 ]/g, '') |
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.
Consider adding a comment explaining the regex pattern used for sanitizing the input. This will help future developers understand the intention behind the pattern.
value={challenge.name} | ||
maxLength='200' | ||
required | ||
onChange={handleChange} |
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.
Ensure that the handleChange
function is correctly handling all edge cases for input sanitization. For example, verify that it doesn't inadvertently remove valid characters or fail to update the input when necessary.
const isReadOnly = checkReadOnlyRoles(auth.token) || loginUserRoleInProject === PROJECT_ROLES.READ | ||
const isAdminOrCopilot = checkAdminOrCopilot(auth.token, activeProject) | ||
|
||
const projectStatus = activeProject && activeProject.status |
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.
Consider using optional chaining (?.
) to safely access status
property of activeProject
. This can help avoid potential errors if activeProject
is null
or undefined
. Example: const projectStatus = activeProject?.status ? activeProject.status.toUpperCase() : ''
.
/> | ||
)} | ||
{(checkAdmin(auth.token) || checkManager(auth.token)) && ( | ||
{(checkAdmin(auth.token) || checkManager(auth.token)) && !isCompletedOrCancelled && ( |
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.
Consider adding a comment to explain the logic behind the !isCompletedOrCancelled
condition to ensure future maintainability and clarity for other developers.
Also: https://topcoder.atlassian.net/browse/PM-1270