mirror of
				https://github.com/strapi/strapi.git
				synced 2025-10-31 18:08:11 +00:00 
			
		
		
		
	Fix no-prototype-builtins rule
This commit is contained in:
		
							parent
							
								
									37e69f2fe1
								
							
						
					
					
						commit
						61c41d821c
					
				| @ -41,7 +41,6 @@ module.exports = { | |||||||
|   rules: { |   rules: { | ||||||
|     'generator-star-spacing': 0, |     'generator-star-spacing': 0, | ||||||
|     'no-console': 0, |     'no-console': 0, | ||||||
|     'no-prototype-builtins': 0, |  | ||||||
|     'require-atomic-updates': 0, |     'require-atomic-updates': 0, | ||||||
|   }, |   }, | ||||||
|   settings: { |   settings: { | ||||||
|  | |||||||
| @ -480,7 +480,7 @@ module.exports = function(strapi) { | |||||||
|                     _.keyBy( |                     _.keyBy( | ||||||
|                       _.filter(definition.attributes, (value, key) => { |                       _.filter(definition.attributes, (value, key) => { | ||||||
|                         if ( |                         if ( | ||||||
|                           value.hasOwnProperty('columnName') && |                           Object.prototype.hasOwnProperty.call(value, 'columnName') && | ||||||
|                           !_.isEmpty(value.columnName) && |                           !_.isEmpty(value.columnName) && | ||||||
|                           value.columnName !== key |                           value.columnName !== key | ||||||
|                         ) { |                         ) { | ||||||
| @ -576,9 +576,9 @@ module.exports = function(strapi) { | |||||||
|                             .attributes, |                             .attributes, | ||||||
|                           details => { |                           details => { | ||||||
|                             if ( |                             if ( | ||||||
|                               details.hasOwnProperty('model') && |                               Object.prototype.hasOwnProperty.call(details, 'model') && | ||||||
|                               details.model === model && |                               details.model === model && | ||||||
|                               details.hasOwnProperty('via') && |                               Object.prototype.hasOwnProperty.call(details, 'via') && | ||||||
|                               details.via === name |                               details.via === name | ||||||
|                             ) { |                             ) { | ||||||
|                               return details; |                               return details; | ||||||
| @ -589,9 +589,9 @@ module.exports = function(strapi) { | |||||||
|                           strapi.models[details.model].attributes, |                           strapi.models[details.model].attributes, | ||||||
|                           details => { |                           details => { | ||||||
|                             if ( |                             if ( | ||||||
|                               details.hasOwnProperty('model') && |                               Object.prototype.hasOwnProperty.call(details, 'model') && | ||||||
|                               details.model === model && |                               details.model === model && | ||||||
|                               details.hasOwnProperty('via') && |                               Object.prototype.hasOwnProperty.call(details, 'via') && | ||||||
|                               details.via === name |                               details.via === name | ||||||
|                             ) { |                             ) { | ||||||
|                               return details; |                               return details; | ||||||
|  | |||||||
| @ -21,7 +21,7 @@ module.exports = { | |||||||
|     // This is not a Bookshelf collection, only the name.
 |     // This is not a Bookshelf collection, only the name.
 | ||||||
|     if (_.isString(collectionIdentity) && !_.isUndefined(models)) { |     if (_.isString(collectionIdentity) && !_.isUndefined(models)) { | ||||||
|       const PK = _.findKey(_.get(models, collectionIdentity + '.attributes'), o => { |       const PK = _.findKey(_.get(models, collectionIdentity + '.attributes'), o => { | ||||||
|         return o.hasOwnProperty('primary'); |         return Object.prototype.hasOwnProperty.call(o, 'primary'); | ||||||
|       }); |       }); | ||||||
| 
 | 
 | ||||||
|       if (!_.isEmpty(PK)) { |       if (!_.isEmpty(PK)) { | ||||||
|  | |||||||
| @ -27,7 +27,7 @@ module.exports = strapi => { | |||||||
|       if (_.isPlainObject(views) && !_.isEmpty(views)) { |       if (_.isPlainObject(views) && !_.isEmpty(views)) { | ||||||
|         const opts = _.clone(views); |         const opts = _.clone(views); | ||||||
| 
 | 
 | ||||||
|         if (opts.hasOwnProperty('default')) { |         if (Object.prototype.hasOwnProperty.call(opts, 'default')) { | ||||||
|           opts.extension = opts.default; |           opts.extension = opts.default; | ||||||
|           delete opts.default; |           delete opts.default; | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -36,7 +36,7 @@ class InputWithAutoFocus extends React.Component { | |||||||
|     if (this.props.filterToFocus === this.props.index) { |     if (this.props.filterToFocus === this.props.index) { | ||||||
|       return new Promise(resolve => { |       return new Promise(resolve => { | ||||||
|         setTimeout(() => { |         setTimeout(() => { | ||||||
|           if (this.inputEl.hasOwnProperty('openCalendar')) { |           if (Object.prototype.hasOwnProperty.call(this.inputEl, 'openCalendar')) { | ||||||
|             this.inputEl.openCalendar(); |             this.inputEl.openCalendar(); | ||||||
|           } else { |           } else { | ||||||
|             this.inputEl.focus(); |             this.inputEl.focus(); | ||||||
|  | |||||||
| @ -141,8 +141,8 @@ export class ListPage extends React.Component { | |||||||
| 
 | 
 | ||||||
|     return Object.keys(attributes).filter(attr => { |     return Object.keys(attributes).filter(attr => { | ||||||
|       return ( |       return ( | ||||||
|         !attributes[attr].hasOwnProperty('collection') && |         !Object.prototype.hasOwnProperty.call(attributes[attr], 'collection') && | ||||||
|         !attributes[attr].hasOwnProperty('model') |         !Object.prototype.hasOwnProperty.call(attributes[attr], 'model') | ||||||
|       ); |       ); | ||||||
|     }); |     }); | ||||||
|   }; |   }; | ||||||
|  | |||||||
| @ -191,8 +191,8 @@ class SettingPage extends React.PureComponent { | |||||||
|       .filter(attr => { |       .filter(attr => { | ||||||
|         return ( |         return ( | ||||||
|           findIndex(this.getListDisplay(), ['name', attr]) === -1 && |           findIndex(this.getListDisplay(), ['name', attr]) === -1 && | ||||||
|           !attributes[attr].hasOwnProperty('collection') && |           !Object.prototype.hasOwnProperty.call(attributes[attr], 'collection') && | ||||||
|           !attributes[attr].hasOwnProperty('model') |           !Object.prototype.hasOwnProperty.call(attributes[attr], 'model') | ||||||
|         ); |         ); | ||||||
|       }) |       }) | ||||||
|       .map(attr => { |       .map(attr => { | ||||||
|  | |||||||
| @ -30,8 +30,8 @@ module.exports = async (ctx, next) => { | |||||||
|     if (controller && action) { |     if (controller && action) { | ||||||
|       // Redirect to specific controller.
 |       // Redirect to specific controller.
 | ||||||
|       if ( |       if ( | ||||||
|         ctx.request.body.hasOwnProperty('fields') && |         Object.prototype.hasOwnProperty.call(ctx.request.body, 'fields') && | ||||||
|         ctx.request.body.hasOwnProperty('files') |         Object.prototype.hasOwnProperty.call(ctx.request.body, 'files') | ||||||
|       ) { |       ) { | ||||||
|         let { files, fields } = ctx.request.body; |         let { files, fields } = ctx.request.body; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -72,7 +72,10 @@ module.exports = { | |||||||
| 
 | 
 | ||||||
|   add: async (params, values, source) => { |   add: async (params, values, source) => { | ||||||
|     // Multipart/form-data.
 |     // Multipart/form-data.
 | ||||||
|     if (values.hasOwnProperty('fields') && values.hasOwnProperty('files')) { |     if ( | ||||||
|  |       Object.prototype.hasOwnProperty.call(values, 'fields') && | ||||||
|  |       Object.prototype.hasOwnProperty.call(values, 'files') | ||||||
|  |     ) { | ||||||
|       // Silent recursive parser.
 |       // Silent recursive parser.
 | ||||||
|       const parser = value => { |       const parser = value => { | ||||||
|         try { |         try { | ||||||
| @ -134,7 +137,10 @@ module.exports = { | |||||||
| 
 | 
 | ||||||
|   edit: async (params, values, source) => { |   edit: async (params, values, source) => { | ||||||
|     // Multipart/form-data.
 |     // Multipart/form-data.
 | ||||||
|     if (values.hasOwnProperty('fields') && values.hasOwnProperty('files')) { |     if ( | ||||||
|  |       Object.prototype.hasOwnProperty.call(values, 'fields') && | ||||||
|  |       Object.prototype.hasOwnProperty.call(values, 'files') | ||||||
|  |     ) { | ||||||
|       // Silent recursive parser.
 |       // Silent recursive parser.
 | ||||||
|       const parser = value => { |       const parser = value => { | ||||||
|         try { |         try { | ||||||
|  | |||||||
| @ -49,7 +49,7 @@ class AttributesPickerModal extends React.Component { | |||||||
|     const appPlugins = plugins; |     const appPlugins = plugins; | ||||||
| 
 | 
 | ||||||
|     return attributes.filter(attr => { |     return attributes.filter(attr => { | ||||||
|       if (appPlugins.hasOwnProperty('upload')) { |       if (Object.prototype.hasOwnProperty.call(appPlugins, 'upload')) { | ||||||
|         return true; |         return true; | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -381,8 +381,8 @@ module.exports = { | |||||||
|       (acc, curr) => { |       (acc, curr) => { | ||||||
|         const attribute = attributes[curr]; |         const attribute = attributes[curr]; | ||||||
|         const isField = |         const isField = | ||||||
|           !attribute.hasOwnProperty('model') && |           !Object.prototype.hasOwnProperty.call(attribute, 'model') && | ||||||
|           !attribute.hasOwnProperty('collection'); |           !Object.prototype.hasOwnProperty.call(attribute, 'collection'); | ||||||
| 
 | 
 | ||||||
|         if (attribute.required) { |         if (attribute.required) { | ||||||
|           acc.required.push(curr); |           acc.required.push(curr); | ||||||
| @ -1525,8 +1525,8 @@ module.exports = { | |||||||
|       .map(attr => { |       .map(attr => { | ||||||
|         const attribute = modelAttributes[attr]; |         const attribute = modelAttributes[attr]; | ||||||
|         const isField = |         const isField = | ||||||
|           !attribute.hasOwnProperty('model') && |           !Object.prototype.hasOwnProperty.call(attribute, 'model') && | ||||||
|           !attribute.hasOwnProperty('collection'); |           !Object.prototype.hasOwnProperty.call(attribute, 'collection'); | ||||||
| 
 | 
 | ||||||
|         if (!isField) { |         if (!isField) { | ||||||
|           const name = attribute.model || attribute.collection; |           const name = attribute.model || attribute.collection; | ||||||
| @ -1730,7 +1730,7 @@ module.exports = { | |||||||
|   mergeComponents: (initObj, srcObj) => { |   mergeComponents: (initObj, srcObj) => { | ||||||
|     const cleanedObj = Object.keys(_.get(initObj, 'schemas', {})).reduce( |     const cleanedObj = Object.keys(_.get(initObj, 'schemas', {})).reduce( | ||||||
|       (acc, current) => { |       (acc, current) => { | ||||||
|         const targetObj = _.get(srcObj, ['schemas'], {}).hasOwnProperty(current) |         const targetObj = Object.prototype.hasOwnProperty.call(_.get(srcObj, ['schemas'], {}), current) | ||||||
|           ? srcObj |           ? srcObj | ||||||
|           : initObj; |           : initObj; | ||||||
| 
 | 
 | ||||||
| @ -1750,7 +1750,7 @@ module.exports = { | |||||||
| 
 | 
 | ||||||
|   mergePaths: function(initObj, srcObj) { |   mergePaths: function(initObj, srcObj) { | ||||||
|     return Object.keys(initObj.paths).reduce((acc, current) => { |     return Object.keys(initObj.paths).reduce((acc, current) => { | ||||||
|       if (_.get(srcObj, ['paths'], {}).hasOwnProperty(current)) { |       if (Object.prototype.hasOwnProperty.call(_.get(srcObj, ['paths'], {}), current)) { | ||||||
|         const verbs = Object.keys(initObj.paths[current]).reduce( |         const verbs = Object.keys(initObj.paths[current]).reduce( | ||||||
|           (acc1, curr) => { |           (acc1, curr) => { | ||||||
|             const verb = this.mergeVerbObject( |             const verb = this.mergeVerbObject( | ||||||
|  | |||||||
| @ -15,7 +15,7 @@ module.exports = (api, controller) => { | |||||||
|     throw new Error('Should be an object'); |     throw new Error('Should be an object'); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   if (_.isObject(controller) && controller.hasOwnProperty('identity')) { |   if (_.isObject(controller) && Object.prototype.hasOwnProperty.call(controller, 'identity')) { | ||||||
|     controller = controller.identity.toLowerCase(); |     controller = controller.identity.toLowerCase(); | ||||||
|   } else if (_.isString(controller)) { |   } else if (_.isString(controller)) { | ||||||
|     controller = controller.toLowerCase(); |     controller = controller.toLowerCase(); | ||||||
|  | |||||||
| @ -108,8 +108,8 @@ module.exports = { | |||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|       if ( |       if ( | ||||||
|         (association.hasOwnProperty('collection') && association.collection === '*') || |         (Object.prototype.hasOwnProperty.call(association, 'collection') && association.collection === '*') || | ||||||
|         (association.hasOwnProperty('model') && association.model === '*') |         (Object.prototype.hasOwnProperty.call(association, 'model') && association.model === '*') | ||||||
|       ) { |       ) { | ||||||
|         if (association.model) { |         if (association.model) { | ||||||
|           types.current = 'morphToD'; |           types.current = 'morphToD'; | ||||||
| @ -130,13 +130,13 @@ module.exports = { | |||||||
|         // We have to find if they are a model linked to this key
 |         // We have to find if they are a model linked to this key
 | ||||||
|         _.forIn(allModels, model => { |         _.forIn(allModels, model => { | ||||||
|           _.forIn(model.attributes, attribute => { |           _.forIn(model.attributes, attribute => { | ||||||
|             if (attribute.hasOwnProperty('via') && attribute.via === key && attribute.model === currentModelName) { |             if (Object.prototype.hasOwnProperty.call(attribute, 'via') && attribute.via === key && attribute.model === currentModelName) { | ||||||
|               if (attribute.hasOwnProperty('collection')) { |               if (Object.prototype.hasOwnProperty.call(attribute, 'collection')) { | ||||||
|                 types.other = 'collection'; |                 types.other = 'collection'; | ||||||
| 
 | 
 | ||||||
|                 // Break loop
 |                 // Break loop
 | ||||||
|                 return false; |                 return false; | ||||||
|               } else if (attribute.hasOwnProperty('model')) { |               } else if (Object.prototype.hasOwnProperty.call(attribute, 'model')) { | ||||||
|                 types.other = 'model'; |                 types.other = 'model'; | ||||||
| 
 | 
 | ||||||
|                 // Break loop
 |                 // Break loop
 | ||||||
| @ -145,7 +145,7 @@ module.exports = { | |||||||
|             } |             } | ||||||
|           }); |           }); | ||||||
|         }); |         }); | ||||||
|       } else if (association.hasOwnProperty('via') && association.hasOwnProperty('collection')) { |       } else if (Object.prototype.hasOwnProperty.call(association, 'via') && Object.prototype.hasOwnProperty.call(association, 'collection')) { | ||||||
|         const relatedAttribute = models[association.collection].attributes[association.via]; |         const relatedAttribute = models[association.collection].attributes[association.via]; | ||||||
| 
 | 
 | ||||||
|         if (!relatedAttribute) { |         if (!relatedAttribute) { | ||||||
| @ -159,23 +159,23 @@ module.exports = { | |||||||
|         types.current = 'collection'; |         types.current = 'collection'; | ||||||
| 
 | 
 | ||||||
|         if ( |         if ( | ||||||
|           relatedAttribute.hasOwnProperty('collection') && |           Object.prototype.hasOwnProperty.call(relatedAttribute, 'collection') && | ||||||
|           relatedAttribute.collection !== '*' && |           relatedAttribute.collection !== '*' && | ||||||
|           relatedAttribute.hasOwnProperty('via') |           Object.prototype.hasOwnProperty.call(relatedAttribute, 'via') | ||||||
|         ) { |         ) { | ||||||
|           types.other = 'collection'; |           types.other = 'collection'; | ||||||
|         } else if ( |         } else if ( | ||||||
|           relatedAttribute.hasOwnProperty('collection') && |           Object.prototype.hasOwnProperty.call(relatedAttribute, 'collection') && | ||||||
|           relatedAttribute.collection !== '*' && |           relatedAttribute.collection !== '*' && | ||||||
|           !relatedAttribute.hasOwnProperty('via') |           !Object.prototype.hasOwnProperty.call(relatedAttribute, 'via') | ||||||
|         ) { |         ) { | ||||||
|           types.other = 'collectionD'; |           types.other = 'collectionD'; | ||||||
|         } else if (relatedAttribute.hasOwnProperty('model') && relatedAttribute.model !== '*') { |         } else if (Object.prototype.hasOwnProperty.call(relatedAttribute, 'model') && relatedAttribute.model !== '*') { | ||||||
|           types.other = 'model'; |           types.other = 'model'; | ||||||
|         } else if (relatedAttribute.hasOwnProperty('collection') || relatedAttribute.hasOwnProperty('model')) { |         } else if (Object.prototype.hasOwnProperty.call(relatedAttribute, 'collection') || Object.prototype.hasOwnProperty.call(relatedAttribute, 'model')) { | ||||||
|           types.other = 'morphTo'; |           types.other = 'morphTo'; | ||||||
|         } |         } | ||||||
|       } else if (association.hasOwnProperty('via') && association.hasOwnProperty('model')) { |       } else if (Object.prototype.hasOwnProperty.call(association, 'via') && Object.prototype.hasOwnProperty.call(association, 'model')) { | ||||||
|         types.current = 'modelD'; |         types.current = 'modelD'; | ||||||
| 
 | 
 | ||||||
|         // We have to find if they are a model linked to this key
 |         // We have to find if they are a model linked to this key
 | ||||||
| @ -183,30 +183,30 @@ module.exports = { | |||||||
|         const attribute = model.attributes[association.via]; |         const attribute = model.attributes[association.via]; | ||||||
| 
 | 
 | ||||||
|         if ( |         if ( | ||||||
|           attribute.hasOwnProperty('via') && |           Object.prototype.hasOwnProperty.call(attribute, 'via') && | ||||||
|           attribute.via === key && |           attribute.via === key && | ||||||
|           attribute.hasOwnProperty('collection') && |           Object.prototype.hasOwnProperty.call(attribute, 'collection') && | ||||||
|           attribute.collection !== '*' |           attribute.collection !== '*' | ||||||
|         ) { |         ) { | ||||||
|           types.other = 'collection'; |           types.other = 'collection'; | ||||||
|         } else if (attribute.hasOwnProperty('model') && attribute.model !== '*') { |         } else if (Object.prototype.hasOwnProperty.call(attribute, 'model') && attribute.model !== '*') { | ||||||
|           types.other = 'model'; |           types.other = 'model'; | ||||||
|         } else if (attribute.hasOwnProperty('collection') || attribute.hasOwnProperty('model')) { |         } else if (Object.prototype.hasOwnProperty.call(attribute, 'collection') || Object.prototype.hasOwnProperty.call(attribute, 'model')) { | ||||||
|           types.other = 'morphTo'; |           types.other = 'morphTo'; | ||||||
|         } |         } | ||||||
|       } else if (association.hasOwnProperty('model')) { |       } else if (Object.prototype.hasOwnProperty.call(association, 'model')) { | ||||||
|         types.current = 'model'; |         types.current = 'model'; | ||||||
| 
 | 
 | ||||||
|         // We have to find if they are a model linked to this key
 |         // We have to find if they are a model linked to this key
 | ||||||
|         _.forIn(models, model => { |         _.forIn(models, model => { | ||||||
|           _.forIn(model.attributes, attribute => { |           _.forIn(model.attributes, attribute => { | ||||||
|             if (attribute.hasOwnProperty('via') && attribute.via === key) { |             if (Object.prototype.hasOwnProperty.call(attribute, 'via') && attribute.via === key) { | ||||||
|               if (attribute.hasOwnProperty('collection')) { |               if (Object.prototype.hasOwnProperty.call(attribute, 'collection')) { | ||||||
|                 types.other = 'collection'; |                 types.other = 'collection'; | ||||||
| 
 | 
 | ||||||
|                 // Break loop
 |                 // Break loop
 | ||||||
|                 return false; |                 return false; | ||||||
|               } else if (attribute.hasOwnProperty('model')) { |               } else if (Object.prototype.hasOwnProperty.call(attribute, 'model')) { | ||||||
|                 types.other = 'modelD'; |                 types.other = 'modelD'; | ||||||
| 
 | 
 | ||||||
|                 // Break loop
 |                 // Break loop
 | ||||||
| @ -215,19 +215,19 @@ module.exports = { | |||||||
|             } |             } | ||||||
|           }); |           }); | ||||||
|         }); |         }); | ||||||
|       } else if (association.hasOwnProperty('collection')) { |       } else if (Object.prototype.hasOwnProperty.call(association, 'collection')) { | ||||||
|         types.current = 'collectionD'; |         types.current = 'collectionD'; | ||||||
| 
 | 
 | ||||||
|         // We have to find if they are a model linked to this key
 |         // We have to find if they are a model linked to this key
 | ||||||
|         _.forIn(models, model => { |         _.forIn(models, model => { | ||||||
|           _.forIn(model.attributes, attribute => { |           _.forIn(model.attributes, attribute => { | ||||||
|             if (attribute.hasOwnProperty('via') && attribute.via === key) { |             if (Object.prototype.hasOwnProperty.call(attribute, 'via') && attribute.via === key) { | ||||||
|               if (attribute.hasOwnProperty('collection')) { |               if (Object.prototype.hasOwnProperty.call(attribute, 'collection')) { | ||||||
|                 types.other = 'collection'; |                 types.other = 'collection'; | ||||||
| 
 | 
 | ||||||
|                 // Break loop
 |                 // Break loop
 | ||||||
|                 return false; |                 return false; | ||||||
|               } else if (attribute.hasOwnProperty('model')) { |               } else if (Object.prototype.hasOwnProperty.call(attribute, 'model')) { | ||||||
|                 types.other = 'modelD'; |                 types.other = 'modelD'; | ||||||
| 
 | 
 | ||||||
|                 // Break loop
 |                 // Break loop
 | ||||||
| @ -268,14 +268,14 @@ module.exports = { | |||||||
|           nature: 'oneMorphToOne', |           nature: 'oneMorphToOne', | ||||||
|           verbose: 'belongsToMorph', |           verbose: 'belongsToMorph', | ||||||
|         }; |         }; | ||||||
|       } else if (types.current === 'morphTo' && (types.other === 'model' || association.hasOwnProperty('model'))) { |       } else if (types.current === 'morphTo' && (types.other === 'model' || Object.prototype.hasOwnProperty.call(association, 'model'))) { | ||||||
|         return { |         return { | ||||||
|           nature: 'manyMorphToOne', |           nature: 'manyMorphToOne', | ||||||
|           verbose: 'belongsToManyMorph', |           verbose: 'belongsToManyMorph', | ||||||
|         }; |         }; | ||||||
|       } else if ( |       } else if ( | ||||||
|         types.current === 'morphTo' && |         types.current === 'morphTo' && | ||||||
|         (types.other === 'collection' || association.hasOwnProperty('collection')) |         (types.other === 'collection' || Object.prototype.hasOwnProperty.call(association, 'collection')) | ||||||
|       ) { |       ) { | ||||||
|         return { |         return { | ||||||
|           nature: 'manyMorphToMany', |           nature: 'manyMorphToMany', | ||||||
| @ -383,7 +383,7 @@ module.exports = { | |||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|       // Exclude non-relational attribute
 |       // Exclude non-relational attribute
 | ||||||
|       if (!association.hasOwnProperty('collection') && !association.hasOwnProperty('model')) { |       if (!Object.prototype.hasOwnProperty.call(association, 'collection') && !Object.prototype.hasOwnProperty.call(association, 'model')) { | ||||||
|         return undefined; |         return undefined; | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
| @ -399,7 +399,7 @@ module.exports = { | |||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|       // Build associations object
 |       // Build associations object
 | ||||||
|       if (association.hasOwnProperty('collection') && association.collection !== '*') { |       if (Object.prototype.hasOwnProperty.call(association, 'collection') && association.collection !== '*') { | ||||||
|         const ast = { |         const ast = { | ||||||
|           alias: key, |           alias: key, | ||||||
|           type: 'collection', |           type: 'collection', | ||||||
| @ -417,7 +417,7 @@ module.exports = { | |||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         definition.associations.push(ast); |         definition.associations.push(ast); | ||||||
|       } else if (association.hasOwnProperty('model') && association.model !== '*') { |       } else if (Object.prototype.hasOwnProperty.call(association, 'model') && association.model !== '*') { | ||||||
|         definition.associations.push({ |         definition.associations.push({ | ||||||
|           alias: key, |           alias: key, | ||||||
|           type: 'model', |           type: 'model', | ||||||
| @ -429,7 +429,7 @@ module.exports = { | |||||||
|           plugin: association.plugin || undefined, |           plugin: association.plugin || undefined, | ||||||
|           filter: details.filter, |           filter: details.filter, | ||||||
|         }); |         }); | ||||||
|       } else if (association.hasOwnProperty('collection') || association.hasOwnProperty('model')) { |       } else if (Object.prototype.hasOwnProperty.call(association, 'collection') || Object.prototype.hasOwnProperty.call(association, 'model')) { | ||||||
|         const pluginsModels = Object.keys(strapi.plugins).reduce((acc, current) => { |         const pluginsModels = Object.keys(strapi.plugins).reduce((acc, current) => { | ||||||
|           Object.keys(strapi.plugins[current].models).forEach(entity => { |           Object.keys(strapi.plugins[current].models).forEach(entity => { | ||||||
|             Object.keys(strapi.plugins[current].models[entity].attributes).forEach(attribute => { |             Object.keys(strapi.plugins[current].models[entity].attributes).forEach(attribute => { | ||||||
| @ -505,7 +505,7 @@ module.exports = { | |||||||
|       }, {}), |       }, {}), | ||||||
|     ); |     ); | ||||||
| 
 | 
 | ||||||
|     if (!models.hasOwnProperty(model)) { |     if (!Object.prototype.hasOwnProperty.call(models, model)) { | ||||||
|       return this.log.error(`The model ${model} can't be found.`); |       return this.log.error(`The model ${model} can't be found.`); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										4
									
								
								packages/strapi/lib/core/bootstrap.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								packages/strapi/lib/core/bootstrap.js
									
									
									
									
										vendored
									
									
								
							| @ -258,7 +258,7 @@ module.exports = function(strapi) { | |||||||
|       ); |       ); | ||||||
|       acc[current] = !_.isObject(currentSettings) ? {} : currentSettings; |       acc[current] = !_.isObject(currentSettings) ? {} : currentSettings; | ||||||
| 
 | 
 | ||||||
|       if (!acc[current].hasOwnProperty('enabled')) { |       if (!Object.prototype.hasOwnProperty.call(acc[current], 'enabled')) { | ||||||
|         strapi.log.warn( |         strapi.log.warn( | ||||||
|           `(middleware:${current}) wasn't loaded due to missing key \`enabled\` in the configuration` |           `(middleware:${current}) wasn't loaded due to missing key \`enabled\` in the configuration` | ||||||
|         ); |         ); | ||||||
| @ -284,7 +284,7 @@ module.exports = function(strapi) { | |||||||
| 
 | 
 | ||||||
|       acc[current] = !_.isObject(currentSettings) ? {} : currentSettings; |       acc[current] = !_.isObject(currentSettings) ? {} : currentSettings; | ||||||
| 
 | 
 | ||||||
|       if (!acc[current].hasOwnProperty('enabled')) { |       if (!Object.prototype.hasOwnProperty.call(acc[current], 'enabled')) { | ||||||
|         strapi.log.warn( |         strapi.log.warn( | ||||||
|           `(hook:${current}) wasn't loaded due to missing key \`enabled\` in the configuration` |           `(hook:${current}) wasn't loaded due to missing key \`enabled\` in the configuration` | ||||||
|         ); |         ); | ||||||
|  | |||||||
| @ -56,7 +56,7 @@ module.exports = strapi => { | |||||||
|           // Exclude routes with prefix.
 |           // Exclude routes with prefix.
 | ||||||
|           const excludedRoutes = _.omitBy( |           const excludedRoutes = _.omitBy( | ||||||
|             plugin.config.routes, |             plugin.config.routes, | ||||||
|             o => !o.config.hasOwnProperty('prefix') |             o => !Object.prototype.hasOwnProperty.call(o.config, 'prefix') | ||||||
|           ); |           ); | ||||||
| 
 | 
 | ||||||
|           _.forEach( |           _.forEach( | ||||||
|  | |||||||
| @ -24,7 +24,7 @@ module.exports = strapi => { | |||||||
|         strapi.config.hooks.session.secretKeys; |         strapi.config.hooks.session.secretKeys; | ||||||
| 
 | 
 | ||||||
|       if ( |       if ( | ||||||
|         strapi.config.middleware.settings.session.hasOwnProperty('client') && |         Object.prototype.hasOwnProperty.call(strapi.config.middleware.settings.session, 'client') && | ||||||
|         _.isString(strapi.config.middleware.settings.session.client) && |         _.isString(strapi.config.middleware.settings.session.client) && | ||||||
|         strapi.config.middleware.settings.session.client !== 'cookie' |         strapi.config.middleware.settings.session.client !== 'cookie' | ||||||
|       ) { |       ) { | ||||||
| @ -52,7 +52,7 @@ module.exports = strapi => { | |||||||
|           }); |           }); | ||||||
|         } |         } | ||||||
|       } else if ( |       } else if ( | ||||||
|         strapi.config.middleware.settings.session.hasOwnProperty('client') && |         Object.prototype.hasOwnProperty.call(strapi.config.middleware.settings.session, 'client') && | ||||||
|         _.isString(strapi.config.middleware.settings.session.client) && |         _.isString(strapi.config.middleware.settings.session.client) && | ||||||
|         strapi.config.middleware.settings.session.client === 'cookie' |         strapi.config.middleware.settings.session.client === 'cookie' | ||||||
|       ) { |       ) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Abdón Rodríguez Davila
						Abdón Rodríguez Davila