Skip to content

Commit

Permalink
feat: Whitelist 'onboarding' in event validation
Browse files Browse the repository at this point in the history
  • Loading branch information
trillium committed Sep 7, 2023
1 parent 6233447 commit 1b65573
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import validator from 'validator';
import { isWordInArrayInString } from './../../../utils/stringUtils.js';
import { el } from 'date-fns/locale';

const validateEventForm = (vals, projectToEdit) => {
let newErrors = {};
Expand All @@ -25,10 +26,14 @@ const validateEventForm = (vals, projectToEdit) => {
vals[key].toLowerCase()
)
) {
newErrors = {
...newErrors,
name: `Event name cannot contain the Project Name: '${projectToEdit.name}'`,
};
if (projectToEdit.name.toLowerCase() === 'onboarding') {
// Do nothing, word `onboarding` has been white-listed
} else {
newErrors = {
...newErrors,
name: `Event name cannot contain the Project Name: '${projectToEdit.name}'`,
};
}
}
break;

Expand Down

0 comments on commit 1b65573

Please sign in to comment.