-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃棞 Set db soft limits #9225
馃棞 Set db soft limits #9225
Conversation
refs TryGhost#8143 Sets soft limits for certain db fields: - `posts`: - `title`: 255 chars (current hard limit: 2,000 chars) - `meta_title`: 300 chars (current hard limit: 2,000 chars) - `meta_description`: 500 chars (current hard limit: 2,000 chars) - `users`: - `bio`: 200 chars (current hard limit: 65,535 chars) - `location`: 150 chars (current hard limit: 65,535 chars) - `meta_description`: 500 chars (current hard limit: 2,000 chars) - `meta_title`: 300 chars (current hard limit: 2,000 chars) - `tags`: - `description`: 500 chars (current hard limit: 65,535 chars) - `meta_title`: 300 chars (current hard limit: 2,000 chars) - `meta_description`: 500 chars (current hard limit: 2,000 chars)
9b182cb
to
8b29bd4
Compare
- Added a specific error message in `validate` fn for `isLength` method. - `validate` will take the `tableName` value as optional argument to provide a user friendly error message when exceeding db soft limits - added more tests for importer
8b29bd4
to
1b4cbe9
Compare
core/server/data/validation/index.js
Outdated
@@ -190,7 +190,12 @@ validateSchema = function validateSchema(tableName, model) { | |||
|
|||
// TODO: check if mandatory values should be enforced | |||
if (model[columnKey] !== null && model[columnKey] !== undefined) { | |||
// check length | |||
// check soft limits first, if present (validations: {isLength: {min, max}}) | |||
if (_.has(schema[tableName][columnKey], 'validations.isLength')) { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Error message looks like this in Admin Client: And this is the error itself:
Let me know, if this is an ok error message @kirrg001 |
- dynamic translation key reading - you can define a custom translation for each validator
I've double checked how the client shows the error. It would be cool to be consistent here and show the same error message as the client. |
@@ -80,6 +80,11 @@ I18n = { | |||
return matchingString; | |||
}, | |||
|
|||
doesTranslationKeyExist: function doesTranslationKeyExist(msgPath) { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
refs #8143
Sets soft limits for certain db fields:
posts
:title
: 255 chars (current hard limit: 2,000 chars)meta_title
: 300 chars (current hard limit: 2,000 chars)meta_description
: 500 chars (current hard limit: 2,000 chars)users
:bio
: 200 chars (current hard limit: 65,535 chars)location
: 150 chars (current hard limit: 65,535 chars)meta_description
: 500 chars (current hard limit: 2,000 chars)meta_title
: 300 chars (current hard limit: 2,000 chars)tags
:description
: 500 chars (current hard limit: 65,535 chars)meta_title
: 300 chars (current hard limit: 2,000 chars)meta_description
: 500 chars (current hard limit: 2,000 chars)Added a specific error message in
validate
fn forisLength
method.validate
will take thetableName
value as optional argument to provide a user friendly error message when exceeding db soft limitsadded tests for importer