mirror of
https://github.com/strapi/strapi.git
synced 2025-08-30 03:33:37 +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) {
|
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' }]});
|
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;
|
return formErrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
"error.attribute.key.taken": "This value already exists",
|
"error.attribute.key.taken": "This value already exists",
|
||||||
"error.attribute.sameKeyAndName": "Can't be equal",
|
"error.attribute.sameKeyAndName": "Can't be equal",
|
||||||
"error.validation.minSupMax": "Can't be superior",
|
"error.validation.minSupMax": "Can't be superior",
|
||||||
|
"error.attribute.forbidden": "This attribute name is reserved",
|
||||||
|
|
||||||
"form.attribute.item.textarea.name": "Name",
|
"form.attribute.item.textarea.name": "Name",
|
||||||
"form.attribute.item.number.name": "Name",
|
"form.attribute.item.number.name": "Name",
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
"error.attribute.key.taken": "Cette valeur existe déjà",
|
"error.attribute.key.taken": "Cette valeur existe déjà",
|
||||||
"error.attribute.sameKeyAndName": "Ne peuvent pas être égaux",
|
"error.attribute.sameKeyAndName": "Ne peuvent pas être égaux",
|
||||||
"error.validation.minSupMax": "Ne peut pas être plus grand",
|
"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.textarea.name": "Nom",
|
||||||
"form.attribute.item.date.name": "Nom",
|
"form.attribute.item.date.name": "Nom",
|
||||||
|
@ -544,14 +544,9 @@ module.exports = {
|
|||||||
if (association.type === 'model') {
|
if (association.type === 'model') {
|
||||||
params.id = obj[association.alias];
|
params.id = obj[association.alias];
|
||||||
} else {
|
} 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.
|
// Get refering model.
|
||||||
const ref = attr.plugin ?
|
const ref = association.plugin ?
|
||||||
strapi.plugins[attr.plugin].models[params.model]:
|
strapi.plugins[association.plugin].models[params.model]:
|
||||||
strapi.models[params.model];
|
strapi.models[params.model];
|
||||||
|
|
||||||
// Apply optional arguments to make more precise nested request.
|
// Apply optional arguments to make more precise nested request.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user