mirror of
				https://github.com/strapi/strapi.git
				synced 2025-10-31 01:47:13 +00:00 
			
		
		
		
	Merge branches 'fix/i18n-locale-queries-forbidden-access' and 'main' of github.com:strapi/strapi into fix/i18n-locale-queries-forbidden-access
This commit is contained in:
		
						commit
						ccf39e4f2f
					
				| @ -51,6 +51,7 @@ module.exports = { | ||||
|     '<rootDir>/packages/admin-test-utils/lib/setup/styled-components.js', | ||||
|     '<rootDir>/packages/admin-test-utils/lib/setup/strapi.js', | ||||
|   ], | ||||
|   testEnvironment: 'jsdom', | ||||
|   transform: { | ||||
|     '^.+\\.js$': ['@swc/jest', { jsc: { parser: { jsx: true, dynamicImport: true } } }], | ||||
|     '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': | ||||
|  | ||||
| @ -87,9 +87,10 @@ | ||||
|     "husky": "3.1.0", | ||||
|     "inquirer": "8.2.4", | ||||
|     "istanbul": "~0.4.2", | ||||
|     "jest": "26.6.3", | ||||
|     "jest-circus": "26.6.3", | ||||
|     "jest-cli": "26.6.3", | ||||
|     "jest": "29.0.0", | ||||
|     "jest-circus": "29.0.0", | ||||
|     "jest-cli": "29.0.0", | ||||
|     "jest-environment-jsdom": "29.0.0", | ||||
|     "jest-watch-typeahead": "0.6.5", | ||||
|     "lerna": "5.4.3", | ||||
|     "lint-staged": "10.5.4", | ||||
|  | ||||
| @ -17,6 +17,7 @@ function SelectMany({ | ||||
|   name, | ||||
|   isDisabled, | ||||
|   isLoading, | ||||
|   loadingMessage, | ||||
|   onInputChange, | ||||
|   onMenuClose, | ||||
|   onMenuOpen, | ||||
| @ -61,6 +62,7 @@ function SelectMany({ | ||||
|         }} | ||||
|         mainField={mainField} | ||||
|         isLoading={isLoading} | ||||
|         loadingMessage={loadingMessage} | ||||
|         isMulti | ||||
|         isSearchable | ||||
|         options={options} | ||||
| @ -119,6 +121,7 @@ SelectMany.propTypes = { | ||||
|   displayNavigationLink: PropTypes.bool.isRequired, | ||||
|   isDisabled: PropTypes.bool.isRequired, | ||||
|   isLoading: PropTypes.bool.isRequired, | ||||
|   loadingMessage: PropTypes.string.isRequired, | ||||
|   mainField: PropTypes.shape({ | ||||
|     name: PropTypes.string.isRequired, | ||||
|     schema: PropTypes.shape({ | ||||
|  | ||||
| @ -14,6 +14,7 @@ function SelectOne({ | ||||
|   name, | ||||
|   isDisabled, | ||||
|   isLoading, | ||||
|   loadingMessage, | ||||
|   onChange, | ||||
|   onInputChange, | ||||
|   onMenuClose, | ||||
| @ -37,6 +38,7 @@ function SelectOne({ | ||||
|         isClearable | ||||
|         isDisabled={isDisabled} | ||||
|         isLoading={isLoading} | ||||
|         loadingMessage={loadingMessage} | ||||
|         mainField={mainField} | ||||
|         options={options} | ||||
|         onChange={onChange} | ||||
| @ -70,6 +72,7 @@ SelectOne.propTypes = { | ||||
|   components: PropTypes.object, | ||||
|   isDisabled: PropTypes.bool.isRequired, | ||||
|   isLoading: PropTypes.bool.isRequired, | ||||
|   loadingMessage: PropTypes.string.isRequired, | ||||
|   mainField: PropTypes.shape({ | ||||
|     name: PropTypes.string.isRequired, | ||||
|     schema: PropTypes.shape({ | ||||
|  | ||||
| @ -282,6 +282,12 @@ function SelectWrapper({ | ||||
|         isDisabled={isDisabled} | ||||
|         isLoading={isLoading} | ||||
|         isClearable | ||||
|         loadingMessage={() => | ||||
|           formatMessage({ | ||||
|             id: getTrad('DynamicTable.relation-loading'), | ||||
|             defaultMessage: 'Relations are loading', | ||||
|           }) | ||||
|         } | ||||
|         mainField={mainField} | ||||
|         move={moveRelation} | ||||
|         name={name} | ||||
|  | ||||
| @ -63,7 +63,7 @@ | ||||
|     "bcryptjs": "2.4.3", | ||||
|     "chalk": "^4.1.1", | ||||
|     "chokidar": "^3.5.1", | ||||
|     "codemirror": "^5.65.6", | ||||
|     "codemirror": "^5.65.8", | ||||
|     "cross-env": "^7.0.3", | ||||
|     "css-loader": "6.7.1", | ||||
|     "date-fns": "2.29.2", | ||||
|  | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -12,16 +12,16 @@ describe('Configuration settings service', () => { | ||||
|       const settings = await settingsService.createDefaultSettings(schema); | ||||
| 
 | ||||
|       expect(settings).toMatchInlineSnapshot(` | ||||
|       Object { | ||||
|         "bulkable": true, | ||||
|         "defaultSortBy": "id", | ||||
|         "defaultSortOrder": "ASC", | ||||
|         "filterable": true, | ||||
|         "mainField": "id", | ||||
|         "pageSize": 10, | ||||
|         "searchable": true, | ||||
|       } | ||||
|     `);
 | ||||
|         { | ||||
|           "bulkable": true, | ||||
|           "defaultSortBy": "id", | ||||
|           "defaultSortOrder": "ASC", | ||||
|           "filterable": true, | ||||
|           "mainField": "id", | ||||
|           "pageSize": 10, | ||||
|           "searchable": true, | ||||
|         } | ||||
|       `);
 | ||||
|     }); | ||||
| 
 | ||||
|     test('uses id as mainField by default', async () => { | ||||
|  | ||||
| @ -1,12 +1,12 @@ | ||||
| // Jest Snapshot v1, https://goo.gl/fbAQLP | ||||
| 
 | ||||
| exports[`Content types service format ContentType Returns consistent schemas 1`] = ` | ||||
| Object { | ||||
| { | ||||
|   "apiID": "my-name", | ||||
|   "plugin": "some-plugin", | ||||
|   "schema": Object { | ||||
|     "attributes": Object { | ||||
|       "title": Object { | ||||
|   "schema": { | ||||
|     "attributes": { | ||||
|       "title": { | ||||
|         "type": "string", | ||||
|       }, | ||||
|     }, | ||||
| @ -15,8 +15,8 @@ Object { | ||||
|     "displayName": "My name", | ||||
|     "draftAndPublish": false, | ||||
|     "kind": "singleType", | ||||
|     "pluginOptions": Object { | ||||
|       "content-manager": Object { | ||||
|     "pluginOptions": { | ||||
|       "content-manager": { | ||||
|         "visible": true, | ||||
|       }, | ||||
|     }, | ||||
|  | ||||
| @ -1,14 +1,14 @@ | ||||
| // Jest Snapshot v1, https://goo.gl/fbAQLP | ||||
| 
 | ||||
| exports[`Content Type Builder - Content types Collection Types Get collection type returns full schema and information 1`] = ` | ||||
| Object { | ||||
|   "data": Object { | ||||
| { | ||||
|   "data": { | ||||
|     "apiID": "test-collection-type", | ||||
|     "schema": Object { | ||||
|       "attributes": Object { | ||||
|         "title": Object { | ||||
|           "pluginOptions": Object { | ||||
|             "i18n": Object { | ||||
|     "schema": { | ||||
|       "attributes": { | ||||
|         "title": { | ||||
|           "pluginOptions": { | ||||
|             "i18n": { | ||||
|               "localized": true, | ||||
|             }, | ||||
|           }, | ||||
| @ -20,8 +20,8 @@ Object { | ||||
|       "displayName": "Test Collection Type", | ||||
|       "draftAndPublish": false, | ||||
|       "kind": "collectionType", | ||||
|       "pluginOptions": Object { | ||||
|         "i18n": Object { | ||||
|       "pluginOptions": { | ||||
|         "i18n": { | ||||
|           "localized": true, | ||||
|         }, | ||||
|       }, | ||||
| @ -36,12 +36,12 @@ Object { | ||||
| `; | ||||
| 
 | ||||
| exports[`Content Type Builder - Content types Collection Types Get collection type returns full schema and informations with draftAndPublish 1`] = ` | ||||
| Object { | ||||
|   "data": Object { | ||||
| { | ||||
|   "data": { | ||||
|     "apiID": "ct-with-dp", | ||||
|     "schema": Object { | ||||
|       "attributes": Object { | ||||
|         "title": Object { | ||||
|     "schema": { | ||||
|       "attributes": { | ||||
|         "title": { | ||||
|           "type": "string", | ||||
|         }, | ||||
|       }, | ||||
|  | ||||
| @ -1,14 +1,14 @@ | ||||
| // Jest Snapshot v1, https://goo.gl/fbAQLP | ||||
| 
 | ||||
| exports[`Content Type Builder - Content types Single Types Get single type returns full schema and information 1`] = ` | ||||
| Object { | ||||
|   "data": Object { | ||||
| { | ||||
|   "data": { | ||||
|     "apiID": "test-single-type", | ||||
|     "schema": Object { | ||||
|       "attributes": Object { | ||||
|         "title": Object { | ||||
|           "pluginOptions": Object { | ||||
|             "i18n": Object { | ||||
|     "schema": { | ||||
|       "attributes": { | ||||
|         "title": { | ||||
|           "pluginOptions": { | ||||
|             "i18n": { | ||||
|               "localized": true, | ||||
|             }, | ||||
|           }, | ||||
| @ -20,8 +20,8 @@ Object { | ||||
|       "displayName": "Test Single Type", | ||||
|       "draftAndPublish": false, | ||||
|       "kind": "singleType", | ||||
|       "pluginOptions": Object { | ||||
|         "i18n": Object { | ||||
|       "pluginOptions": { | ||||
|         "i18n": { | ||||
|           "localized": true, | ||||
|         }, | ||||
|       }, | ||||
|  | ||||
| @ -17,7 +17,13 @@ const ReactSelect = ({ components, styles, error, ariaErrorMessage, ...props }) | ||||
|     <Select | ||||
|       {...props} | ||||
|       menuPosition="fixed" | ||||
|       components={{ ClearIndicator, DropdownIndicator, IndicatorSeparator, ...components }} | ||||
|       components={{ | ||||
|         ClearIndicator, | ||||
|         DropdownIndicator, | ||||
|         IndicatorSeparator, | ||||
|         LoadingIndicator: () => null, | ||||
|         ...components, | ||||
|       }} | ||||
|       aria-errormessage={error && ariaErrorMessage} | ||||
|       aria-invalid={!!error} | ||||
|       styles={{ ...customStyles, ...styles }} | ||||
|  | ||||
| @ -45,12 +45,12 @@ module.exports = (strapi) => { | ||||
|     environment: strapi.config.environment, | ||||
|     os: os.type(), | ||||
|     osPlatform: os.platform(), | ||||
|     osArch: os.arch(), | ||||
|     osRelease: os.release(), | ||||
|     nodeVersion: process.version, | ||||
|     nodeVersion: process.versions.node, | ||||
|     docker: process.env.DOCKER || isDocker(), | ||||
|     isCI: ciEnv.isCI, | ||||
|     version: strapi.config.get('info.strapi'), | ||||
|     strapiVersion: strapi.config.get('info.strapi'), | ||||
|     projectType: isEE ? 'Enterprise' : 'Community', | ||||
|     useTypescriptOnServer: isUsingTypeScriptSync(serverRootPath), | ||||
|     useTypescriptOnAdmin: isUsingTypeScriptSync(adminRootPath), | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| // Jest Snapshot v1, https://goo.gl/fbAQLP | ||||
| 
 | ||||
| exports[`SelectTree renders 1`] = ` | ||||
| Object { | ||||
| { | ||||
|   "asFragment": [Function], | ||||
|   "baseElement": .c3 { | ||||
|   border: 0; | ||||
|  | ||||
| @ -1,22 +1,22 @@ | ||||
| // Jest Snapshot v1, https://goo.gl/fbAQLP | ||||
| 
 | ||||
| exports[`flattenTree flattens the passed tree structure properly 1`] = ` | ||||
| Array [ | ||||
|   Object { | ||||
| [ | ||||
|   { | ||||
|     "depth": 0, | ||||
|     "label": "Folder 1", | ||||
|     "parent": undefined, | ||||
|     "value": "f-1", | ||||
|   }, | ||||
|   Object { | ||||
|     "children": Array [ | ||||
|       Object { | ||||
|   { | ||||
|     "children": [ | ||||
|       { | ||||
|         "label": "Folder 2-1", | ||||
|         "value": "f-2-1", | ||||
|       }, | ||||
|       Object { | ||||
|         "children": Array [ | ||||
|           Object { | ||||
|       { | ||||
|         "children": [ | ||||
|           { | ||||
|             "label": "Folder 2-2-1", | ||||
|             "value": "f-2-2-1", | ||||
|           }, | ||||
| @ -30,15 +30,15 @@ Array [ | ||||
|     "parent": undefined, | ||||
|     "value": "f-2", | ||||
|   }, | ||||
|   Object { | ||||
|   { | ||||
|     "depth": 1, | ||||
|     "label": "Folder 2-1", | ||||
|     "parent": "f-2", | ||||
|     "value": "f-2-1", | ||||
|   }, | ||||
|   Object { | ||||
|     "children": Array [ | ||||
|       Object { | ||||
|   { | ||||
|     "children": [ | ||||
|       { | ||||
|         "label": "Folder 2-2-1", | ||||
|         "value": "f-2-2-1", | ||||
|       }, | ||||
| @ -48,7 +48,7 @@ Array [ | ||||
|     "parent": "f-2", | ||||
|     "value": "f-2-2", | ||||
|   }, | ||||
|   Object { | ||||
|   { | ||||
|     "depth": 2, | ||||
|     "label": "Folder 2-2-1", | ||||
|     "parent": "f-2-2", | ||||
|  | ||||
| @ -2,11 +2,6 @@ | ||||
| 
 | ||||
| const metricsService = require('../metrics'); | ||||
| 
 | ||||
| // TODO: the matcher exists in jest@28
 | ||||
| const closeTo = (expected, precision = 2) => ({ | ||||
|   asymmetricMatch: (actual) => Math.abs(expected - actual) < 10 ** -precision / 2, | ||||
| }); | ||||
| 
 | ||||
| describe('metrics', () => { | ||||
|   describe('computeMetrics', () => { | ||||
|     test.each([ | ||||
| @ -95,9 +90,9 @@ describe('metrics', () => { | ||||
|       expect(results).toMatchObject({ | ||||
|         assetNumber, | ||||
|         folderNumber, | ||||
|         averageDepth: closeTo(averageDepth, 3), | ||||
|         averageDepth: expect.closeTo(averageDepth, 3), | ||||
|         maxDepth, | ||||
|         averageDeviationDepth: closeTo(averageDeviationDepth, 3), | ||||
|         averageDeviationDepth: expect.closeTo(averageDeviationDepth, 3), | ||||
|       }); | ||||
|     }); | ||||
|   }); | ||||
|  | ||||
| @ -58,12 +58,12 @@ const generateNewApp = (projectDirectory, cliArguments) => { | ||||
| 
 | ||||
|   sentry.configureScope(function scope(sentryScope) { | ||||
|     const tags = { | ||||
|       os_arch: os.arch(), | ||||
|       os_type: os.type(), | ||||
|       os_platform: os.platform(), | ||||
|       os_release: os.release(), | ||||
|       strapi_version: scope.strapiVersion, | ||||
|       node_version: process.version, | ||||
|       os: os.type(), | ||||
|       osPlatform: os.platform(), | ||||
|       osArch: os.arch(), | ||||
|       osRelease: os.release(), | ||||
|       version: scope.strapiVersion, | ||||
|       nodeVersion: process.versions.node, | ||||
|       docker: scope.docker, | ||||
|     }; | ||||
| 
 | ||||
|  | ||||
| @ -53,6 +53,21 @@ function captureStderr(name, error) { | ||||
|   return captureError(name); | ||||
| } | ||||
| 
 | ||||
| const getProperties = (scope, error) => ({ | ||||
|   error: typeof error === 'string' ? error : error && error.message, | ||||
|   os: os.type(), | ||||
|   osPlatform: os.platform(), | ||||
|   osArch: os.arch(), | ||||
|   osRelease: os.release(), | ||||
|   version: scope.strapiVersion, | ||||
|   nodeVersion: process.versions.node, | ||||
|   docker: scope.docker, | ||||
|   useYarn: scope.useYarn, | ||||
|   useTypescriptOnServer: scope.useTypescript, | ||||
|   useTypescriptOnAdmin: scope.useTypescript, | ||||
|   noRun: (scope.runQuickstartApp !== true).toString(), | ||||
| }); | ||||
| 
 | ||||
| function trackEvent(event, body) { | ||||
|   if (process.env.NODE_ENV === 'test') { | ||||
|     return; | ||||
| @ -76,19 +91,7 @@ function trackEvent(event, body) { | ||||
| 
 | ||||
| function trackError({ scope, error }) { | ||||
|   const { uuid } = scope; | ||||
| 
 | ||||
|   const properties = { | ||||
|     error: typeof error === 'string' ? error : error && error.message, | ||||
|     os: os.type(), | ||||
|     platform: os.platform(), | ||||
|     release: os.release(), | ||||
|     version: scope.strapiVersion, | ||||
|     nodeVersion: process.version, | ||||
|     docker: scope.docker, | ||||
|     useYarn: scope.useYarn, | ||||
|     useTypescriptOnServer: scope.useTypescript, | ||||
|     useTypescriptOnAdmin: scope.useTypescript, | ||||
|   }; | ||||
|   const properties = getProperties(scope, error); | ||||
| 
 | ||||
|   try { | ||||
|     return trackEvent('didNotCreateProject', { | ||||
| @ -104,21 +107,7 @@ function trackError({ scope, error }) { | ||||
| 
 | ||||
| function trackUsage({ event, scope, error }) { | ||||
|   const { uuid } = scope; | ||||
| 
 | ||||
|   const properties = { | ||||
|     error: typeof error === 'string' ? error : error && error.message, | ||||
|     os: os.type(), | ||||
|     os_arch: os.arch(), | ||||
|     os_platform: os.platform(), | ||||
|     os_release: os.release(), | ||||
|     node_version: process.version, | ||||
|     version: scope.strapiVersion, | ||||
|     docker: scope.docker, | ||||
|     useYarn: scope.useYarn.toString(), | ||||
|     useTypescriptOnServer: scope.useTypescript, | ||||
|     useTypescriptOnAdmin: scope.useTypescript, | ||||
|     noRun: (scope.runQuickstartApp !== true).toString(), | ||||
|   }; | ||||
|   const properties = getProperties(scope, error); | ||||
| 
 | ||||
|   try { | ||||
|     return trackEvent(event, { | ||||
|  | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Convly
						Convly