-
Notifications
You must be signed in to change notification settings - Fork 44
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
Simplified /writeUserSettings params #9124
base: master
Are you sure you want to change the base?
Conversation
1a04d8b
to
4998787
Compare
!( | ||
typeof disable_rich_text !== 'boolean' || | ||
typeof promotional_emails_enabled !== 'boolean' || | ||
email_notification_interval |
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 logic seems incorrect. If disable_rich_text !== 'boolean'
is true then the conditional evaluates to false and an InvalidSetting error is not returned.
return next(new AppError(Errors.InvalidSetting)); | ||
} | ||
|
||
return res.json({ status: 'Success', result: { key, value } }); | ||
if (typeof disable_rich_text === '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.
This stuff should be validated ahead of time and an error thrown earlier if the type is incorrect. If the conditionals are set up correct then Typescript should be able to automatically narrow down the type to Boolean.
@mzparacha let's try to cleanup the PR list. This one is pretty old, I guess it might be closed? Or let's plan how to proceed |
Thanks for the reminder @masvelio, i will try to update it by EOW. |
Link to Issue
Closes: #8393
Description of Changes
Simplified /writeUserSettings params, replacing
key: string / value: string
param pairs with proper param names"How We Fixed It"
N/A
Test Plan
Deployment Plan
N/A
Other Considerations
This PR doesn't aim to move the modified API to newer standards, its just about cleaning up the params which caused some confusion in an earlier PR.