mirror of
https://github.com/strapi/strapi.git
synced 2025-08-29 19:22:24 +00:00
Merge branch 'master' into graphql-use-playground
This commit is contained in:
commit
c5d11e270b
@ -1,4 +1,4 @@
|
||||
import { get, filter, isNumber, size, split, isEmpty, has, map, concat } from 'lodash';
|
||||
import { get, filter, isNumber, size, split, isEmpty, has, map, concat, includes } from 'lodash';
|
||||
|
||||
export default function checkAttributeValidations(errors) {
|
||||
|
||||
@ -36,6 +36,34 @@ export default function checkAttributeValidations(errors) {
|
||||
formErrors.push({ name: 'params.key', errors: [{ id: 'content-type-builder.error.attribute.sameKeyAndName' }]});
|
||||
}
|
||||
|
||||
const reserved = [
|
||||
'id',
|
||||
'set',
|
||||
'value',
|
||||
'emit',
|
||||
'on',
|
||||
'once',
|
||||
'listeners',
|
||||
'removeListener',
|
||||
'collection',
|
||||
'db',
|
||||
'isModified',
|
||||
'isNew',
|
||||
'get',
|
||||
'modelName',
|
||||
'save',
|
||||
'schema',
|
||||
'toObject',
|
||||
'validate',
|
||||
'remove',
|
||||
'_pres',
|
||||
'_posts',
|
||||
];
|
||||
|
||||
if (includes(reserved, get(this.props.modifiedDataAttribute, 'name'))) {
|
||||
formErrors.push({ name: 'name', errors: [{ id: 'content-type-builder.error.attribute.forbidden' }]});
|
||||
}
|
||||
|
||||
return formErrors;
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,7 @@
|
||||
"error.attribute.key.taken": "This value already exists",
|
||||
"error.attribute.sameKeyAndName": "Can't be equal",
|
||||
"error.validation.minSupMax": "Can't be superior",
|
||||
"error.attribute.forbidden": "This attribute name is reserved",
|
||||
|
||||
"form.attribute.item.textarea.name": "Name",
|
||||
"form.attribute.item.number.name": "Name",
|
||||
|
@ -44,6 +44,7 @@
|
||||
"error.attribute.key.taken": "Cette valeur existe déjà",
|
||||
"error.attribute.sameKeyAndName": "Ne peuvent pas être égaux",
|
||||
"error.validation.minSupMax": "Ne peut pas être plus grand",
|
||||
"error.attribute.forbidden": "Cet attribut est réservé",
|
||||
|
||||
"form.attribute.item.textarea.name": "Nom",
|
||||
"form.attribute.item.date.name": "Nom",
|
||||
|
@ -544,14 +544,9 @@ module.exports = {
|
||||
if (association.type === 'model') {
|
||||
params.id = obj[association.alias];
|
||||
} else {
|
||||
// Get attribute.
|
||||
const attr = association.plugin ?
|
||||
strapi.plugins[association.plugin].models[params.model].attributes[association.via]:
|
||||
strapi.models[params.model].attributes[association.via];
|
||||
|
||||
// Get refering model.
|
||||
const ref = attr.plugin ?
|
||||
strapi.plugins[attr.plugin].models[params.model]:
|
||||
const ref = association.plugin ?
|
||||
strapi.plugins[association.plugin].models[params.model]:
|
||||
strapi.models[params.model];
|
||||
|
||||
// Apply optional arguments to make more precise nested request.
|
||||
|
Loading…
x
Reference in New Issue
Block a user