mirror of
				https://github.com/strapi/strapi.git
				synced 2025-10-31 01:47:13 +00:00 
			
		
		
		
	Fix general settings global udpdates
This commit is contained in:
		
							parent
							
								
									85762551aa
								
							
						
					
					
						commit
						128b26f1ee
					
				| @ -25,8 +25,9 @@ module.exports = { | ||||
|       strapi.plugins['content-manager'].services.contenttypes; | ||||
| 
 | ||||
|     const configurations = await storeUtils.getAllConfigurations(); | ||||
| 
 | ||||
|     await Promise.all( | ||||
|       configurations.map(({ value }) => { | ||||
|       configurations.map(value => { | ||||
|         const { uid, source } = value; | ||||
|         const settings = { | ||||
|           ...value.settings, | ||||
|  | ||||
| @ -2,7 +2,14 @@ | ||||
| 
 | ||||
| const _ = require('lodash'); | ||||
| 
 | ||||
| const pickSchemaFields = model => _.pick(model, []); | ||||
| const pickSchemaFields = model => | ||||
|   _.pick(model, [ | ||||
|     'connection', | ||||
|     'collectionName', | ||||
|     'info', | ||||
|     'options', | ||||
|     'attributes', | ||||
|   ]); | ||||
| 
 | ||||
| module.exports = { | ||||
|   pickSchemaFields, | ||||
|  | ||||
| @ -15,31 +15,6 @@ const getStore = () => { | ||||
|   }); | ||||
| }; | ||||
| 
 | ||||
| function getAllConfigurationsQuery({ model }) { | ||||
|   if (model.orm === 'mongoose') { | ||||
|     return model | ||||
|       .find({ | ||||
|         $regex: `plugin_content_manager_configuration.*`, | ||||
|       }) | ||||
|       .then(results => | ||||
|         results.map(({ key, value }) => ({ key, value: JSON.parse(value) })) | ||||
|       ); | ||||
|   } | ||||
| 
 | ||||
|   return model | ||||
|     .query(qb => { | ||||
|       qb.where('key', 'like', `plugin_content_manager_configuration%`); | ||||
|     }) | ||||
|     .fetchAll() | ||||
|     .then(config => config && config.toJSON()) | ||||
|     .then(results => | ||||
|       results.map(({ key, value }) => ({ key, value: JSON.parse(value) })) | ||||
|     ); | ||||
| } | ||||
| 
 | ||||
| const getAllConfigurations = () => | ||||
|   strapi.query('core_store').custom(getAllConfigurationsQuery)(); | ||||
| 
 | ||||
| /** General settings */ | ||||
| 
 | ||||
| const getGeneralSettings = () => | ||||
| @ -99,7 +74,7 @@ function findByKeyQuery({ model }, key) { | ||||
|   if (model.orm === 'mongoose') { | ||||
|     return model | ||||
|       .find({ | ||||
|         $regex: `${key}.*`, | ||||
|         key: { $regex: `${key}.*` }, | ||||
|       }) | ||||
|       .then(results => results.map(({ value }) => JSON.parse(value))); | ||||
|   } | ||||
| @ -115,6 +90,9 @@ function findByKeyQuery({ model }, key) { | ||||
| 
 | ||||
| const findByKey = key => strapi.query('core_store').custom(findByKeyQuery)(key); | ||||
| 
 | ||||
| const getAllConfigurations = () => | ||||
|   findByKey('plugin_content_manager_configuration'); | ||||
| 
 | ||||
| module.exports = { | ||||
|   getGeneralSettings, | ||||
|   setGeneralSettings, | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Alexandre Bodin
						Alexandre Bodin