-
Notifications
You must be signed in to change notification settings - Fork 33
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 motion create form #4286
Fix motion create form #4286
Conversation
if (update[key] === null || update[key].length === 0) { | ||
delete update[key]; | ||
} |
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.
Probably not a good idea: null's the value we use to signify that a value is to be deleted, removing all keys with that value is going to remove that functionality. Also you can't guarantee that every key is an array.
What I think you really want to do, is removing certain keys depending on whether the user is even allowed to set them according to his permissions
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.
for the motion.create it is enough to remove every null/empty array from the payload. The permissions do not have to be verified, given that a user can only send null/[] for the fields they are not allowed to change
For the motion.update it is wrong to remove empty arrays or null values
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.
From a functional perspective it works.
closes #4285