From ab5b80e9341ed97cf9ab649f041abfb475423f0b Mon Sep 17 00:00:00 2001 From: Javier Castro Date: Fri, 7 Dec 2018 12:19:51 -0300 Subject: [PATCH 01/34] Fix #2444: avoid duplicating the message when wrapping errors with Bom --- packages/strapi/lib/middlewares/boom/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/strapi/lib/middlewares/boom/index.js b/packages/strapi/lib/middlewares/boom/index.js index c73b8d57ea..1b7dc2a98a 100644 --- a/packages/strapi/lib/middlewares/boom/index.js +++ b/packages/strapi/lib/middlewares/boom/index.js @@ -37,7 +37,7 @@ module.exports = strapi => { ctx.status = error.status || 500; ctx.body = _.get(ctx.body, 'isBoom') ? ctx.body || error && error.message - : Boom.wrap(error, ctx.status, ctx.body || error.message); + : Boom.wrap(error, ctx.status); } if (ctx.response.headers.location) { From 012b0c5e0ca99f0d7207c9dd28b2ff5e787ee2aa Mon Sep 17 00:00:00 2001 From: Michael Barajas Date: Sun, 16 Dec 2018 14:46:22 -0500 Subject: [PATCH 02/34] Updated documentation for model indexing --- docs/3.x.x/guides/models.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/3.x.x/guides/models.md b/docs/3.x.x/guides/models.md index c286de9bc6..50ca2245a8 100644 --- a/docs/3.x.x/guides/models.md +++ b/docs/3.x.x/guides/models.md @@ -56,6 +56,7 @@ If you're using SQL databases, you should use the native SQL constraints to appl - `required` (boolean) — if true adds a required validator for this property. - `unique` (boolean) — whether to define a unique index on this property. + - `index` (boolean) — adds an index on this property, this will use the default mongodb index for the type and will run in the background. - `max` (integer) — checks if the value is greater than or equal to the given minimum. - `min` (integer) — checks if the value is less than or equal to the given maximum. @@ -100,7 +101,8 @@ To improve the Developer eXperience when developing or using the administration "age": { "type": "integer", "min": 18, - "max": 99 + "max": 99, + "index": true }, "birthday": { "type": "date" From a5dc07c0a5fb76f3ad0dba3ef8c48903b0cf6aee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abdo=CC=81n=20Rodri=CC=81guez=20Davila?= Date: Wed, 19 Dec 2018 19:25:52 +0100 Subject: [PATCH 03/34] Avoid write files if not development environment --- packages/strapi-plugin-graphql/services/Schema.js | 6 ++++-- packages/strapi/lib/core/plugins.js | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/strapi-plugin-graphql/services/Schema.js b/packages/strapi-plugin-graphql/services/Schema.js index d13249e3ed..dcb8a29949 100644 --- a/packages/strapi-plugin-graphql/services/Schema.js +++ b/packages/strapi-plugin-graphql/services/Schema.js @@ -266,8 +266,10 @@ module.exports = { resolvers, }); - // Write schema. - this.writeGenerateSchema(graphql.printSchema(schema)); + if (strapi.config.environment === 'development') { + // Write schema. + this.writeGenerateSchema(graphql.printSchema(schema)); + } // Remove custom scaler (like Upload); typeDefs = Types.removeCustomScalar(typeDefs, resolvers); diff --git a/packages/strapi/lib/core/plugins.js b/packages/strapi/lib/core/plugins.js index 51893e0f8b..d239e96b0a 100644 --- a/packages/strapi/lib/core/plugins.js +++ b/packages/strapi/lib/core/plugins.js @@ -88,6 +88,10 @@ module.exports = async function() { return; } + if (strapi.config.environment !== 'development') { + return; + } + // arrange system directories await Promise.all([ fs.remove(sourcePath), From df162c13878f0144c3bd82ec1a64e2cd2564104f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abdo=CC=81n=20Rodri=CC=81guez=20Davila?= Date: Wed, 19 Dec 2018 19:42:10 +0100 Subject: [PATCH 04/34] Avoid write actions.json if not development environment --- .../services/UsersPermissions.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/strapi-plugin-users-permissions/services/UsersPermissions.js b/packages/strapi-plugin-users-permissions/services/UsersPermissions.js index 397fb1221a..35ed7cfdf6 100644 --- a/packages/strapi-plugin-users-permissions/services/UsersPermissions.js +++ b/packages/strapi-plugin-users-permissions/services/UsersPermissions.js @@ -438,8 +438,10 @@ module.exports = { try { // Disable auto-reload. strapi.reload.isWatching = false; - // Rewrite actions.json file. - fs.writeFileSync(actionsPath, JSON.stringify({ actions: data }), 'utf8'); + if (strapi.config.environment === 'development') { + // Rewrite actions.json file. + fs.writeFileSync(actionsPath, JSON.stringify({ actions: data }), 'utf8'); + } // Set value to AST to avoid restart. _.set(strapi.plugins['users-permissions'], 'config.actions', data); // Disable auto-reload. From cbcd8749a32ccd7ea8d96e523079c07a58b53849 Mon Sep 17 00:00:00 2001 From: Michael Barajas Date: Wed, 19 Dec 2018 14:40:33 -0500 Subject: [PATCH 05/34] Updated models to document mongodbs index --- docs/3.x.x/guides/models.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/3.x.x/guides/models.md b/docs/3.x.x/guides/models.md index 50ca2245a8..48e4664901 100644 --- a/docs/3.x.x/guides/models.md +++ b/docs/3.x.x/guides/models.md @@ -56,7 +56,7 @@ If you're using SQL databases, you should use the native SQL constraints to appl - `required` (boolean) — if true adds a required validator for this property. - `unique` (boolean) — whether to define a unique index on this property. - - `index` (boolean) — adds an index on this property, this will use the default mongodb index for the type and will run in the background. + - `index` (boolean) — adds an index on this property, this will create a [single field index](https://docs.mongodb.com/manual/indexes/#single-field) that will run in the background. - `max` (integer) — checks if the value is greater than or equal to the given minimum. - `min` (integer) — checks if the value is less than or equal to the given maximum. From 7d039644fae62e63994546783fade20158db72ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abdo=CC=81n=20Rodri=CC=81guez=20Davila?= Date: Sun, 23 Dec 2018 17:02:45 +0100 Subject: [PATCH 06/34] Check if plugins.json exists --- packages/strapi/lib/core/plugins.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/strapi/lib/core/plugins.js b/packages/strapi/lib/core/plugins.js index d239e96b0a..04e8b10625 100644 --- a/packages/strapi/lib/core/plugins.js +++ b/packages/strapi/lib/core/plugins.js @@ -88,8 +88,11 @@ module.exports = async function() { return; } - if (strapi.config.environment !== 'development') { + const existBuildPath = await fs.pathExists(buildPath); + if (strapi.config.environment !== 'development' && existBuildPath) { return; + } else if (strapi.config.environment !== 'development' && !existBuildPath) { + console.log('The plugins.json file is missing and the front-end cannot work without it. Please, create it first at development environment.'); } // arrange system directories @@ -97,7 +100,6 @@ module.exports = async function() { fs.remove(sourcePath), (async () => { - const existBuildPath = await fs.pathExists(buildPath); if (existBuildPath) { await fs.remove(buildPath); } else { From 382722b74c1b59d4c7d0560e9d0751f750f1d910 Mon Sep 17 00:00:00 2001 From: Paolo Ragone Date: Wed, 26 Dec 2018 11:10:35 +1300 Subject: [PATCH 07/34] Fix provider query building bug Fixes #2536 Does so by fixing the parameters to the query call --- .../strapi-plugin-users-permissions/services/Providers.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/strapi-plugin-users-permissions/services/Providers.js b/packages/strapi-plugin-users-permissions/services/Providers.js index 158674e7b9..79e7e891b4 100644 --- a/packages/strapi-plugin-users-permissions/services/Providers.js +++ b/packages/strapi-plugin-users-permissions/services/Providers.js @@ -47,7 +47,10 @@ exports.connect = (provider, query) => { try { const users = await strapi.query('user', 'users-permissions').find({ where: { - email: profile.email + email: { + symbol: '=', + value: profile.email + } } }); @@ -85,6 +88,7 @@ exports.connect = (provider, query) => { return resolve([createdUser, null]); } catch (err) { + strapi.log.error(err) reject([null, err]); } }); From 947dd2b5023e2bcca42effeae6ccefab077388ad Mon Sep 17 00:00:00 2001 From: Paolo Ragone Date: Wed, 26 Dec 2018 12:11:12 +1300 Subject: [PATCH 08/34] Added missing semicolon --- packages/strapi-plugin-users-permissions/services/Providers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/strapi-plugin-users-permissions/services/Providers.js b/packages/strapi-plugin-users-permissions/services/Providers.js index 79e7e891b4..a281b8b4d7 100644 --- a/packages/strapi-plugin-users-permissions/services/Providers.js +++ b/packages/strapi-plugin-users-permissions/services/Providers.js @@ -88,7 +88,7 @@ exports.connect = (provider, query) => { return resolve([createdUser, null]); } catch (err) { - strapi.log.error(err) + strapi.log.error(err); reject([null, err]); } }); From b04ba69370254fa745ae63b91db3e587de15b4d2 Mon Sep 17 00:00:00 2001 From: Chaitanya Choudhary Date: Fri, 28 Dec 2018 14:17:12 +0530 Subject: [PATCH 09/34] Ability to use custom timestamps. --- packages/strapi-hook-bookshelf/lib/index.js | 10 +++++----- packages/strapi-hook-mongoose/lib/index.js | 5 ++++- .../admin/src/containers/EditPage/saga.js | 13 ++++--------- .../config/functions/bootstrap.js | 4 +++- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/packages/strapi-hook-bookshelf/lib/index.js b/packages/strapi-hook-bookshelf/lib/index.js index c4e6b7a533..a57b73f54a 100644 --- a/packages/strapi-hook-bookshelf/lib/index.js +++ b/packages/strapi-hook-bookshelf/lib/index.js @@ -89,7 +89,7 @@ module.exports = function(strapi) { // Register the final model for Bookshelf. const loadedModel = _.assign({ tableName: definition.collectionName, - hasTimestamps: _.get(definition, 'options.timestamps') === true, + hasTimestamps: _.get(definition, 'options.timestamps'), idAttribute: _.get(definition, 'options.idAttribute', 'id'), associations: [], defaults: Object.keys(definition.attributes).reduce((acc, current) => { @@ -619,10 +619,10 @@ module.exports = function(strapi) { // Add created_at and updated_at field if timestamp option is true if (loadedModel.hasTimestamps) { - definition.attributes['created_at'] = { + definition.attributes[loadedModel.hasTimestamps[0]] = { type: 'timestamp' }; - definition.attributes['updated_at'] = { + definition.attributes[loadedModel.hasTimestamps[1]] = { type: 'timestampUpdate' }; } @@ -701,8 +701,8 @@ module.exports = function(strapi) { // Remove from attributes (auto handled by bookshlef and not displayed on ctb) if (loadedModel.hasTimestamps) { - delete definition.attributes['created_at']; - delete definition.attributes['updated_at']; + delete definition.attributes[loadedModel.hasTimestamps[0]]; + delete definition.attributes[loadedModel.hasTimestamps[1]]; } resolve(); diff --git a/packages/strapi-hook-mongoose/lib/index.js b/packages/strapi-hook-mongoose/lib/index.js index 025ea36247..0c3654837f 100644 --- a/packages/strapi-hook-mongoose/lib/index.js +++ b/packages/strapi-hook-mongoose/lib/index.js @@ -207,7 +207,10 @@ module.exports = function (strapi) { }); }); - collection.schema.set('timestamps', _.get(definition, 'options.timestamps') === true); + let timestamps = {}; + _.set(timestamps.createdAt, _.get(definition, 'options.timestamps[0]')); + _.set(timestamps.updatedAt, _.get(definition, 'options.timestamps[1]')); + collection.schema.set('timestamps', timestamps); collection.schema.set('minimize', _.get(definition, 'options.minimize', false) === true); collection.schema.options.toObject = collection.schema.options.toJSON = { diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/saga.js b/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/saga.js index 1c906ba375..cd94930713 100644 --- a/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/saga.js +++ b/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/saga.js @@ -77,15 +77,10 @@ export function* submit() { let shouldAddTranslationSuffix = false; // Remove the updated_at & created_at fields so it is updated correctly when using Postgres or MySQL db - if (record.updated_at) { - delete record.created_at; - delete record.updated_at; - } - - // Remove the updatedAt & createdAt fields so it is updated correctly when using MongoDB - if (record.updatedAt) { - delete record.createdAt; - delete record.updatedAt; + const timestamps = get(schema, ['models', currentModelName, 'options', 'timestamps'], null); + if (timestamps) { + delete record[timestamps[0]]; + delete record[timestamps[1]]; } try { diff --git a/packages/strapi-plugin-content-manager/config/functions/bootstrap.js b/packages/strapi-plugin-content-manager/config/functions/bootstrap.js index 19f95e9c33..3935330f40 100644 --- a/packages/strapi-plugin-content-manager/config/functions/bootstrap.js +++ b/packages/strapi-plugin-content-manager/config/functions/bootstrap.js @@ -17,6 +17,7 @@ const pickData = (model) => _.pick(model, [ 'globalId', 'globalName', 'orm', + 'options.timestamps', 'loadedModel', 'primaryKey', 'associations' @@ -330,8 +331,9 @@ module.exports = async cb => { // Here we just need to add the data from the current schema Object apisToAdd.map(apiPath => { const api = _.get(schema.models, apiPath); - const { search, filters, bulkActions, pageEntries } = _.get(prevSchema, 'generalSettings'); + const { search, filters, bulkActions, pageEntries, options } = _.get(prevSchema, 'generalSettings'); + _.set(api, 'options', options); _.set(api, 'filters', filters); _.set(api, 'search', search); _.set(api, 'bulkActions', bulkActions); From 6835fdf4263e6af7f2981cc4a198ebeed6d2b75b Mon Sep 17 00:00:00 2001 From: Chaitanya Choudhary Date: Fri, 28 Dec 2018 17:04:36 +0530 Subject: [PATCH 10/34] Handle different types of timestamp values --- packages/strapi-hook-bookshelf/lib/index.js | 19 +++++++++++++------ packages/strapi-hook-mongoose/lib/index.js | 14 ++++++++++---- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/packages/strapi-hook-bookshelf/lib/index.js b/packages/strapi-hook-bookshelf/lib/index.js index a57b73f54a..3d1c0649b6 100644 --- a/packages/strapi-hook-bookshelf/lib/index.js +++ b/packages/strapi-hook-bookshelf/lib/index.js @@ -89,7 +89,7 @@ module.exports = function(strapi) { // Register the final model for Bookshelf. const loadedModel = _.assign({ tableName: definition.collectionName, - hasTimestamps: _.get(definition, 'options.timestamps'), + hasTimestamps: _.get(definition, 'options.timestamps', false), idAttribute: _.get(definition, 'options.idAttribute', 'id'), associations: [], defaults: Object.keys(definition.attributes).reduce((acc, current) => { @@ -100,7 +100,14 @@ module.exports = function(strapi) { return acc; }, {}) }, definition.options); - + // Use default timestamp column names if value is `true` + if (_.get(loadedModel, 'hasTimestamps') === true) { + _.set(loadedModel, 'hasTimestamps', ['created_at', 'updated_at']); + } + // Use false for values other than `Boolean` or `Array` + if (!_.isArray(_.get(loadedModel, 'hasTimestamps')) || !_.isBoolean(_.get(loadedModel, 'hasTimestamps'))) { + _.set(loadedModel, 'hasTimestamps', false); + } if (_.isString(_.get(connection, 'options.pivot_prefix'))) { loadedModel.toJSON = function(options = {}) { const { shallow = false, omitPivot = false } = options; @@ -619,10 +626,10 @@ module.exports = function(strapi) { // Add created_at and updated_at field if timestamp option is true if (loadedModel.hasTimestamps) { - definition.attributes[loadedModel.hasTimestamps[0]] = { + definition.attributes[_.isString(loadedModel.hasTimestamps[0]) ? loadedModel.hasTimestamps[0] : 'created_at'] = { type: 'timestamp' }; - definition.attributes[loadedModel.hasTimestamps[1]] = { + definition.attributes[_.isString(loadedModel.hasTimestamps[1]) ? loadedModel.hasTimestamps[1] : 'updated_at'] = { type: 'timestampUpdate' }; } @@ -701,8 +708,8 @@ module.exports = function(strapi) { // Remove from attributes (auto handled by bookshlef and not displayed on ctb) if (loadedModel.hasTimestamps) { - delete definition.attributes[loadedModel.hasTimestamps[0]]; - delete definition.attributes[loadedModel.hasTimestamps[1]]; + delete definition.attributes[_.isString(loadedModel.hasTimestamps[0]) ? loadedModel.hasTimestamps[0] : 'created_at']; + delete definition.attributes[_.isString(loadedModel.hasTimestamps[1]) ? loadedModel.hasTimestamps[1] : 'updated_at']; } resolve(); diff --git a/packages/strapi-hook-mongoose/lib/index.js b/packages/strapi-hook-mongoose/lib/index.js index 0c3654837f..80ab48fcaf 100644 --- a/packages/strapi-hook-mongoose/lib/index.js +++ b/packages/strapi-hook-mongoose/lib/index.js @@ -207,10 +207,16 @@ module.exports = function (strapi) { }); }); - let timestamps = {}; - _.set(timestamps.createdAt, _.get(definition, 'options.timestamps[0]')); - _.set(timestamps.updatedAt, _.get(definition, 'options.timestamps[1]')); - collection.schema.set('timestamps', timestamps); + // Use provided timestamps if the elemnets in the array are string else use default. + if (_.isArray(_.get(definition, 'options.timestamps'))) { + const timestamps = { + createdAt: _.isString(_.get(definition, 'options.timestamps[0]')) ? _.get(definition, 'options.timestamps[0]') : 'createdAt', + updatedAt: _.isString(_.get(definition, 'options.timestamps[1]')) ? _.get(definition, 'options.timestamps[1]') : 'updatedAt' + }; + collection.schema.set('timestamps', timestamps); + } else { + collection.schema.set('timestamps', _.get(definition, 'options.timestamps') === true); + } collection.schema.set('minimize', _.get(definition, 'options.minimize', false) === true); collection.schema.options.toObject = collection.schema.options.toJSON = { From 1c4aafae5b30c08272c0022a3e3219375afbf3ff Mon Sep 17 00:00:00 2001 From: Chaitanya Choudhary Date: Fri, 28 Dec 2018 19:24:24 +0530 Subject: [PATCH 11/34] Fixed conditional statement for hasTimestamps --- packages/strapi-hook-bookshelf/lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/strapi-hook-bookshelf/lib/index.js b/packages/strapi-hook-bookshelf/lib/index.js index 3d1c0649b6..abfaa347bb 100644 --- a/packages/strapi-hook-bookshelf/lib/index.js +++ b/packages/strapi-hook-bookshelf/lib/index.js @@ -105,7 +105,7 @@ module.exports = function(strapi) { _.set(loadedModel, 'hasTimestamps', ['created_at', 'updated_at']); } // Use false for values other than `Boolean` or `Array` - if (!_.isArray(_.get(loadedModel, 'hasTimestamps')) || !_.isBoolean(_.get(loadedModel, 'hasTimestamps'))) { + if (!_.isArray(_.get(loadedModel, 'hasTimestamps')) && !_.isBoolean(_.get(loadedModel, 'hasTimestamps'))) { _.set(loadedModel, 'hasTimestamps', false); } if (_.isString(_.get(connection, 'options.pivot_prefix'))) { From 3950503acfba9fa989cad5d0ab9d9cba67a0a2ce Mon Sep 17 00:00:00 2001 From: Justin Greene Date: Sun, 30 Dec 2018 18:17:05 -0600 Subject: [PATCH 12/34] Update inquirer to fix windows console freezing --- packages/strapi-generate-new/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/strapi-generate-new/package.json b/packages/strapi-generate-new/package.json index fdfb911a97..20428b7a8c 100644 --- a/packages/strapi-generate-new/package.json +++ b/packages/strapi-generate-new/package.json @@ -15,7 +15,7 @@ "dependencies": { "enpeem": "^2.2.0", "fs-extra": "^4.0.0", - "inquirer": "^4.0.2", + "inquirer": "^6.2.1", "listr": "^0.14.1", "lodash": "^4.17.5", "ora": "^2.1.0", @@ -49,4 +49,4 @@ "npm": ">= 6.0.0" }, "license": "MIT" -} \ No newline at end of file +} From 9755836c5d2ca0ca222c554ef46d515adb603ae6 Mon Sep 17 00:00:00 2001 From: Justin Greene Date: Sun, 30 Dec 2018 18:17:58 -0600 Subject: [PATCH 13/34] Update inquirer to fix windows hang --- packages/strapi-hook-bookshelf/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/strapi-hook-bookshelf/package.json b/packages/strapi-hook-bookshelf/package.json index 2a02e9b4ed..5c9cbc5ba2 100644 --- a/packages/strapi-hook-bookshelf/package.json +++ b/packages/strapi-hook-bookshelf/package.json @@ -17,7 +17,7 @@ "main": "./lib", "dependencies": { "bookshelf": "^0.12.1", - "inquirer": "^5.2.0", + "inquirer": "^6.2.1", "lodash": "^4.17.5", "pluralize": "^6.0.0", "rimraf": "^2.6.2", @@ -56,4 +56,4 @@ "npm": ">= 6.0.0" }, "license": "MIT" -} \ No newline at end of file +} From 2ab9be48ee87f8a76812268d84f8565b15a8e6f0 Mon Sep 17 00:00:00 2001 From: soupette Date: Thu, 3 Jan 2019 17:24:06 +0100 Subject: [PATCH 14/34] Fixes #2555 --- .../strapi-plugin-users-permissions/config/routes.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/strapi-plugin-users-permissions/config/routes.json b/packages/strapi-plugin-users-permissions/config/routes.json index 848bfbb616..5598810339 100644 --- a/packages/strapi-plugin-users-permissions/config/routes.json +++ b/packages/strapi-plugin-users-permissions/config/routes.json @@ -111,6 +111,14 @@ "policies": [] } }, + { + "method": "GET", + "path": "/permissions", + "handler": "UsersPermissions.getPermissions", + "config": { + "policies": [] + } + }, { "method": "GET", "path": "/providers", From ed16bdb30548719561a8c664a09d95535849c6e3 Mon Sep 17 00:00:00 2001 From: codarrior Date: Fri, 4 Jan 2019 17:13:04 +1100 Subject: [PATCH 15/34] Update deployment guide with helpful hint Deployment guide enhanced for helpful hint for production environment setup. --- docs/3.x.x/guides/deployment.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/3.x.x/guides/deployment.md b/docs/3.x.x/guides/deployment.md index 3c69f63588..eaf8a6da34 100644 --- a/docs/3.x.x/guides/deployment.md +++ b/docs/3.x.x/guides/deployment.md @@ -21,6 +21,22 @@ Update the `production` settings with the IP and domain name where the project w In case your database is not running on the same server, make sure that the environment of your production database (`./config/environments/production/database.json`) is set properly. +If you are passing a number of configuration item values via environment variables which is always encouraged for production environment to keep application stateless, checkout the section for [Dynamic Configuration](../configurations/configurations.md#dynamic-configurations). Here is a hint on how to do it for production, for the configuration mentioned above: + + **Path —** `./config/environments/production/server.json`. +```js +{ + "host": "${process.env.APP_HOST || '127.0.0.1'}" + "port": "${process.env.NODE_PORT || 1337}", + "autoReload": { + "enabled": false + }, + "admin": { + "path": "/dashboard" // We highly recommend to change the default `/admin` path for security reasons. + } +} +``` + **⚠️ If you changed the path to access to the administration, the step #2 is required.** #### #2 - Setup (optional) From dd4d869e0122485ee21976824ac2065dc86f4c19 Mon Sep 17 00:00:00 2001 From: Chaitanya Choudhary Date: Fri, 4 Jan 2019 15:22:07 +0530 Subject: [PATCH 16/34] Fixed mongo updated timestamp issue. --- .../strapi-plugin-content-manager/config/functions/bootstrap.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/strapi-plugin-content-manager/config/functions/bootstrap.js b/packages/strapi-plugin-content-manager/config/functions/bootstrap.js index 3935330f40..3886c5b8cc 100644 --- a/packages/strapi-plugin-content-manager/config/functions/bootstrap.js +++ b/packages/strapi-plugin-content-manager/config/functions/bootstrap.js @@ -85,6 +85,7 @@ module.exports = async cb => { pageEntries: 10, defaultSort: model.primaryKey, sort: 'ASC', + options: model.options, editDisplay: { availableFields: {}, fields: [], From febd868feef9ac2a4bf9c5bf78c11cc8b467fbb3 Mon Sep 17 00:00:00 2001 From: Chaitanya Choudhary Date: Fri, 4 Jan 2019 15:40:47 +0530 Subject: [PATCH 17/34] Updated documentation for timestamp values. --- docs/3.x.x/guides/models.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/3.x.x/guides/models.md b/docs/3.x.x/guides/models.md index c286de9bc6..edb9cc73f3 100644 --- a/docs/3.x.x/guides/models.md +++ b/docs/3.x.x/guides/models.md @@ -27,6 +27,7 @@ The info key on the model-json states information about the model. This informat The options key on the model-json states. - `idAttribute`: This tells the model which attribute to expect as the unique identifier for each database row (typically an auto-incrementing primary key named 'id'). _Only valid for strapi-hook-bookshelf_ - `idAttributeType`: Data type of `idAttribute`, accepted list of value bellow. _Only valid for strapi-hook-bookshelf_ + - `timestamps`: This tells the model which attributes to use for timestamps. Accepts either `boolean` or `Array` of strings where frist element is create data and second elemtent is update date. Default value when set to `true` for Bookshelf is `["created_at", "updated_at"]` and for MongoDB is `["createdAt", "updatedAt"]`. ## Define the attributes From d142b02f619e404a295c18da1ec092f64d5b7c30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Georget?= Date: Sat, 5 Jan 2019 16:53:05 +0100 Subject: [PATCH 18/34] Add logo to documentation plugin --- .../strapi-plugin-documentation/admin/src/assets/images/logo.svg | 1 + 1 file changed, 1 insertion(+) create mode 100644 packages/strapi-plugin-documentation/admin/src/assets/images/logo.svg diff --git a/packages/strapi-plugin-documentation/admin/src/assets/images/logo.svg b/packages/strapi-plugin-documentation/admin/src/assets/images/logo.svg new file mode 100644 index 0000000000..ca58a5d865 --- /dev/null +++ b/packages/strapi-plugin-documentation/admin/src/assets/images/logo.svg @@ -0,0 +1 @@ +🗂 \ No newline at end of file From 2b3af8300c44a229370aadb4b26a70d7fb7cc3be Mon Sep 17 00:00:00 2001 From: Jim LAURIE Date: Sun, 6 Jan 2019 14:00:04 +0100 Subject: [PATCH 19/34] Add migration of jwt.json file --- .../migration-guide/migration-guide-alpha.10-to-alpha.11.md | 2 +- .../migration-guide/migration-guide-alpha.11-to-alpha.12.md | 2 +- .../migration-guide/migration-guide-alpha.12.1-to-alpha.12.2.md | 2 +- .../migration-guide/migration-guide-alpha.12.2-to-alpha.12.3.md | 2 +- .../migration-guide/migration-guide-alpha.12.3-to-alpha.12.4.md | 2 +- .../migration-guide/migration-guide-alpha.12.4-to-alpha.12.5.md | 2 +- .../migration-guide/migration-guide-alpha.12.5-to-alpha.12.6.md | 2 +- .../migration-guide/migration-guide-alpha.12.6-to-alpha.12.7.md | 2 +- .../migration-guide/migration-guide-alpha.12.7-to-alpha.13.md | 2 +- .../migration-guide/migration-guide-alpha.13-to-alpha.13.1.md | 2 +- .../migration-guide/migration-guide-alpha.13.1-to-alpha.14.md | 2 +- .../migration-guide/migration-guide-alpha.14-to-alpha.14.1.md | 2 +- .../migration-guide/migration-guide-alpha.14.1-to-alpha.14.2.md | 2 +- .../migration-guide/migration-guide-alpha.14.2-to-alpha.14.3.md | 2 +- .../migration-guide/migration-guide-alpha.14.3-to-alpha.14.4.md | 2 +- .../migration-guide/migration-guide-alpha.14.4-to-alpha.14.5.md | 2 +- .../migration-guide/migration-guide-alpha.14.5-to-alpha.15.md | 2 +- .../migration-guide/migration-guide-alpha.15-to-alpha.16.md | 2 +- .../migration-guide/migration-guide-alpha.16-to-alpha.17.md | 2 +- .../migration-guide/migration-guide-alpha.17-to-alpha.18.md | 2 +- .../3.x.x/migration-guide/migration-guide-alpha.8-to-alpha.9.md | 2 +- .../migration-guide/migration-guide-alpha.9-to-alpha.10.md | 2 +- .../admin/src/containers/AuthPage/saga.js | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/docs/3.x.x/migration-guide/migration-guide-alpha.10-to-alpha.11.md b/docs/3.x.x/migration-guide/migration-guide-alpha.10-to-alpha.11.md index ee8ae2bc7b..499da425b4 100644 --- a/docs/3.x.x/migration-guide/migration-guide-alpha.10-to-alpha.11.md +++ b/docs/3.x.x/migration-guide/migration-guide-alpha.10-to-alpha.11.md @@ -49,7 +49,7 @@ Delete your old admin folder and replace it by the new one. Copy this file `/plugins/users-permissions/config/jwt.json` **from your old project** and paste it in the corresponding one in your new project. -Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` file in the new one. +Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` and `/plugins/users-permissions/config/jwt.json` file in the new one. Then, delete your old `plugins` folder and replace it by the new one. diff --git a/docs/3.x.x/migration-guide/migration-guide-alpha.11-to-alpha.12.md b/docs/3.x.x/migration-guide/migration-guide-alpha.11-to-alpha.12.md index 99f919af0b..b241352b6d 100644 --- a/docs/3.x.x/migration-guide/migration-guide-alpha.11-to-alpha.12.md +++ b/docs/3.x.x/migration-guide/migration-guide-alpha.11-to-alpha.12.md @@ -45,7 +45,7 @@ Delete your old admin folder and replace it by the new one. ## Update the Plugins -Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` file in the new one. +Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` and `/plugins/users-permissions/config/jwt.json` file in the new one. Then, delete your old `plugins` folder and replace it by the new one. diff --git a/docs/3.x.x/migration-guide/migration-guide-alpha.12.1-to-alpha.12.2.md b/docs/3.x.x/migration-guide/migration-guide-alpha.12.1-to-alpha.12.2.md index 617e4ceb4f..a46511eaee 100644 --- a/docs/3.x.x/migration-guide/migration-guide-alpha.12.1-to-alpha.12.2.md +++ b/docs/3.x.x/migration-guide/migration-guide-alpha.12.1-to-alpha.12.2.md @@ -50,7 +50,7 @@ Delete your old admin folder and replace it by the new one. If you did custom update on one of the plugin, you will have to manually migrate your update. ::: -Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` file in the new one. +Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` and `/plugins/users-permissions/config/jwt.json` file in the new one. Then, delete your old `plugins` folder and replace it by the new one. diff --git a/docs/3.x.x/migration-guide/migration-guide-alpha.12.2-to-alpha.12.3.md b/docs/3.x.x/migration-guide/migration-guide-alpha.12.2-to-alpha.12.3.md index 8a5c3fcc04..eb73c78b2a 100644 --- a/docs/3.x.x/migration-guide/migration-guide-alpha.12.2-to-alpha.12.3.md +++ b/docs/3.x.x/migration-guide/migration-guide-alpha.12.2-to-alpha.12.3.md @@ -52,7 +52,7 @@ Delete your old admin folder and replace it with the new one. If you did a custom update on one of the plugins, you will have to manually migrate your update. ::: -Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` file in the new one. +Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` and `/plugins/users-permissions/config/jwt.json` file in the new one. Then, delete your old `plugins` folder and replace it with the new one. diff --git a/docs/3.x.x/migration-guide/migration-guide-alpha.12.3-to-alpha.12.4.md b/docs/3.x.x/migration-guide/migration-guide-alpha.12.3-to-alpha.12.4.md index 3e6cb83e65..d2047ad8fd 100644 --- a/docs/3.x.x/migration-guide/migration-guide-alpha.12.3-to-alpha.12.4.md +++ b/docs/3.x.x/migration-guide/migration-guide-alpha.12.3-to-alpha.12.4.md @@ -51,7 +51,7 @@ Delete your old admin folder and replace it with the new one. If you did a custom update on one of the plugins, you will have to manually migrate your update. ::: -Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` file in the new one. +Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` and `/plugins/users-permissions/config/jwt.json` file in the new one. Then, delete your old `plugins` folder and replace it with the new one. diff --git a/docs/3.x.x/migration-guide/migration-guide-alpha.12.4-to-alpha.12.5.md b/docs/3.x.x/migration-guide/migration-guide-alpha.12.4-to-alpha.12.5.md index 40383792be..96f7896bc5 100644 --- a/docs/3.x.x/migration-guide/migration-guide-alpha.12.4-to-alpha.12.5.md +++ b/docs/3.x.x/migration-guide/migration-guide-alpha.12.4-to-alpha.12.5.md @@ -50,7 +50,7 @@ Delete your old admin folder and replace it with the new one. If you did a custom update on one of the plugins, you will have to manually migrate your update. ::: -Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` file in the new one. +Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` and `/plugins/users-permissions/config/jwt.json` file in the new one. Then, delete your old `plugins` folder and replace it with the new one. diff --git a/docs/3.x.x/migration-guide/migration-guide-alpha.12.5-to-alpha.12.6.md b/docs/3.x.x/migration-guide/migration-guide-alpha.12.5-to-alpha.12.6.md index 0c501cec7c..582d46174c 100644 --- a/docs/3.x.x/migration-guide/migration-guide-alpha.12.5-to-alpha.12.6.md +++ b/docs/3.x.x/migration-guide/migration-guide-alpha.12.5-to-alpha.12.6.md @@ -52,7 +52,7 @@ Delete your old admin folder and replace it with the new one. If you did a custom update on one of the plugins, you will have to manually migrate your update. ::: -Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` file in the new one. +Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` and `/plugins/users-permissions/config/jwt.json` file in the new one. Then, delete your old `plugins` folder and replace it with the new one. diff --git a/docs/3.x.x/migration-guide/migration-guide-alpha.12.6-to-alpha.12.7.md b/docs/3.x.x/migration-guide/migration-guide-alpha.12.6-to-alpha.12.7.md index e5e572c1c7..c837e6ee86 100644 --- a/docs/3.x.x/migration-guide/migration-guide-alpha.12.6-to-alpha.12.7.md +++ b/docs/3.x.x/migration-guide/migration-guide-alpha.12.6-to-alpha.12.7.md @@ -50,7 +50,7 @@ Delete your old admin folder and replace it with the new one. If you did a custom update on one of the plugins, you will have to manually migrate your update. ::: -Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` file in the new one. +Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` and `/plugins/users-permissions/config/jwt.json` file in the new one. Then, delete your old `plugins` folder and replace it with the new one. diff --git a/docs/3.x.x/migration-guide/migration-guide-alpha.12.7-to-alpha.13.md b/docs/3.x.x/migration-guide/migration-guide-alpha.12.7-to-alpha.13.md index ab9ca361c1..ea64fa1317 100644 --- a/docs/3.x.x/migration-guide/migration-guide-alpha.12.7-to-alpha.13.md +++ b/docs/3.x.x/migration-guide/migration-guide-alpha.12.7-to-alpha.13.md @@ -50,7 +50,7 @@ Delete your old admin folder and replace it with the new one. If you did a custom update on one of the plugins, you will have to manually migrate your update. ::: -Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` file in the new one. +Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` and `/plugins/users-permissions/config/jwt.json` file in the new one. Then, delete your old `plugins` folder and replace it with the new one. diff --git a/docs/3.x.x/migration-guide/migration-guide-alpha.13-to-alpha.13.1.md b/docs/3.x.x/migration-guide/migration-guide-alpha.13-to-alpha.13.1.md index 115d438be3..4753f0d87a 100644 --- a/docs/3.x.x/migration-guide/migration-guide-alpha.13-to-alpha.13.1.md +++ b/docs/3.x.x/migration-guide/migration-guide-alpha.13-to-alpha.13.1.md @@ -51,7 +51,7 @@ Delete your old admin folder and replace it with the new one. If you did a custom update on one of the plugins, you will have to manually migrate your update. ::: -Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` file in the new one. +Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` and `/plugins/users-permissions/config/jwt.json` file in the new one. Then, delete your old `plugins` folder and replace it with the new one. diff --git a/docs/3.x.x/migration-guide/migration-guide-alpha.13.1-to-alpha.14.md b/docs/3.x.x/migration-guide/migration-guide-alpha.13.1-to-alpha.14.md index 6bcf9c6266..be26b35945 100644 --- a/docs/3.x.x/migration-guide/migration-guide-alpha.13.1-to-alpha.14.md +++ b/docs/3.x.x/migration-guide/migration-guide-alpha.13.1-to-alpha.14.md @@ -51,7 +51,7 @@ Delete your old admin folder and replace it with the new one. If you did a custom update on one of the plugins, you will have to manually migrate your update. ::: -Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` file in the new one. +Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` and `/plugins/users-permissions/config/jwt.json` file in the new one. Then, delete your old `plugins` folder and replace it with the new one. diff --git a/docs/3.x.x/migration-guide/migration-guide-alpha.14-to-alpha.14.1.md b/docs/3.x.x/migration-guide/migration-guide-alpha.14-to-alpha.14.1.md index be905d6945..46bab8798c 100644 --- a/docs/3.x.x/migration-guide/migration-guide-alpha.14-to-alpha.14.1.md +++ b/docs/3.x.x/migration-guide/migration-guide-alpha.14-to-alpha.14.1.md @@ -50,7 +50,7 @@ Delete your old admin folder and replace it with the new one. If you did a custom update on one of the plugins, you will have to manually migrate your update. ::: -Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` file in the new one. +Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` and `/plugins/users-permissions/config/jwt.json` file in the new one. Then, delete your old `plugins` folder and replace it with the new one. diff --git a/docs/3.x.x/migration-guide/migration-guide-alpha.14.1-to-alpha.14.2.md b/docs/3.x.x/migration-guide/migration-guide-alpha.14.1-to-alpha.14.2.md index efb9d11724..70ae766485 100644 --- a/docs/3.x.x/migration-guide/migration-guide-alpha.14.1-to-alpha.14.2.md +++ b/docs/3.x.x/migration-guide/migration-guide-alpha.14.1-to-alpha.14.2.md @@ -50,7 +50,7 @@ Delete your old admin folder and replace it with the new one. If you did a custom update on one of the plugins, you will have to manually migrate your update. ::: -Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` file in the new one. +Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` and `/plugins/users-permissions/config/jwt.json` file in the new one. Then, delete your old `plugins` folder and replace it with the new one. diff --git a/docs/3.x.x/migration-guide/migration-guide-alpha.14.2-to-alpha.14.3.md b/docs/3.x.x/migration-guide/migration-guide-alpha.14.2-to-alpha.14.3.md index dcca160861..65f7374d82 100644 --- a/docs/3.x.x/migration-guide/migration-guide-alpha.14.2-to-alpha.14.3.md +++ b/docs/3.x.x/migration-guide/migration-guide-alpha.14.2-to-alpha.14.3.md @@ -50,7 +50,7 @@ Delete your old admin folder and replace it with the new one. If you did a custom update on one of the plugins, you will have to manually migrate your update. ::: -Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` file in the new one. +Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` and `/plugins/users-permissions/config/jwt.json` file in the new one. Then, delete your old `plugins` folder and replace it with the new one. diff --git a/docs/3.x.x/migration-guide/migration-guide-alpha.14.3-to-alpha.14.4.md b/docs/3.x.x/migration-guide/migration-guide-alpha.14.3-to-alpha.14.4.md index 44b7ccf907..52a24ffe6f 100644 --- a/docs/3.x.x/migration-guide/migration-guide-alpha.14.3-to-alpha.14.4.md +++ b/docs/3.x.x/migration-guide/migration-guide-alpha.14.3-to-alpha.14.4.md @@ -44,7 +44,7 @@ Delete your old admin folder and replace it with the new one. If you did a custom update on one of the plugins, you will have to manually migrate your update. ::: -Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` file in the new one. +Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` and `/plugins/users-permissions/config/jwt.json` file in the new one. Then, delete your old `plugins` folder and replace it with the new one. diff --git a/docs/3.x.x/migration-guide/migration-guide-alpha.14.4-to-alpha.14.5.md b/docs/3.x.x/migration-guide/migration-guide-alpha.14.4-to-alpha.14.5.md index 5af978fd02..f395127c84 100644 --- a/docs/3.x.x/migration-guide/migration-guide-alpha.14.4-to-alpha.14.5.md +++ b/docs/3.x.x/migration-guide/migration-guide-alpha.14.4-to-alpha.14.5.md @@ -50,7 +50,7 @@ Delete your old admin folder and replace it with the new one. If you did a custom update on one of the plugins, you will have to manually migrate your update. ::: -Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` file in the new one. +Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` and `/plugins/users-permissions/config/jwt.json` file in the new one. Then, delete your old `plugins` folder and replace it with the new one. diff --git a/docs/3.x.x/migration-guide/migration-guide-alpha.14.5-to-alpha.15.md b/docs/3.x.x/migration-guide/migration-guide-alpha.14.5-to-alpha.15.md index e481ea6586..90a0ec9a83 100644 --- a/docs/3.x.x/migration-guide/migration-guide-alpha.14.5-to-alpha.15.md +++ b/docs/3.x.x/migration-guide/migration-guide-alpha.14.5-to-alpha.15.md @@ -50,7 +50,7 @@ Delete your old admin folder and replace it with the new one. If you did a custom update on one of the plugins, you will have to manually migrate your update. ::: -Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` file in the new one. +Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` and `/plugins/users-permissions/config/jwt.json` file in the new one. Then, delete your old `plugins` folder and replace it with the new one. diff --git a/docs/3.x.x/migration-guide/migration-guide-alpha.15-to-alpha.16.md b/docs/3.x.x/migration-guide/migration-guide-alpha.15-to-alpha.16.md index 8da2aaf60f..e9a103e80b 100644 --- a/docs/3.x.x/migration-guide/migration-guide-alpha.15-to-alpha.16.md +++ b/docs/3.x.x/migration-guide/migration-guide-alpha.15-to-alpha.16.md @@ -48,7 +48,7 @@ Delete your old admin folder and replace it with the new one. If you did a custom update on one of the plugins, you will have to manually migrate your update. ::: -Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` file in the new one. +Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` and `/plugins/users-permissions/config/jwt.json` file in the new one. Then, delete your old `plugins` folder and replace it with the new one. diff --git a/docs/3.x.x/migration-guide/migration-guide-alpha.16-to-alpha.17.md b/docs/3.x.x/migration-guide/migration-guide-alpha.16-to-alpha.17.md index 4a2bb70ac6..dc8aa358f8 100644 --- a/docs/3.x.x/migration-guide/migration-guide-alpha.16-to-alpha.17.md +++ b/docs/3.x.x/migration-guide/migration-guide-alpha.16-to-alpha.17.md @@ -50,7 +50,7 @@ Delete your old admin folder and replace it with the new one. If you did a custom update on one of the plugins, you will have to manually migrate your update. ::: -Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` file in the new one. +Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` and `/plugins/users-permissions/config/jwt.json` file in the new one. Then, delete your old `plugins` folder and replace it with the new one. diff --git a/docs/3.x.x/migration-guide/migration-guide-alpha.17-to-alpha.18.md b/docs/3.x.x/migration-guide/migration-guide-alpha.17-to-alpha.18.md index 048f573b62..77baf53262 100644 --- a/docs/3.x.x/migration-guide/migration-guide-alpha.17-to-alpha.18.md +++ b/docs/3.x.x/migration-guide/migration-guide-alpha.17-to-alpha.18.md @@ -50,7 +50,7 @@ Delete your old admin folder and replace it with the new one. If you did a custom update on one of the plugins, you will have to manually migrate your update. ::: -Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` file in the new one. +Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` and `/plugins/users-permissions/config/jwt.json` file in the new one. Then, delete your old `plugins` folder and replace it with the new one. diff --git a/docs/3.x.x/migration-guide/migration-guide-alpha.8-to-alpha.9.md b/docs/3.x.x/migration-guide/migration-guide-alpha.8-to-alpha.9.md index 396bef9ab2..7186ae1a48 100644 --- a/docs/3.x.x/migration-guide/migration-guide-alpha.8-to-alpha.9.md +++ b/docs/3.x.x/migration-guide/migration-guide-alpha.8-to-alpha.9.md @@ -60,7 +60,7 @@ Delete your old admin folder and replace it by the new one. Copy this file `/plugins/users-permissions/config/jwt.json` **from your old project** and paste it in the corresponding one in your new project. -Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` file in the new one. +Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` and `/plugins/users-permissions/config/jwt.json` file in the new one. Then, delete your old `plugins` folder and replace it by the new one. diff --git a/docs/3.x.x/migration-guide/migration-guide-alpha.9-to-alpha.10.md b/docs/3.x.x/migration-guide/migration-guide-alpha.9-to-alpha.10.md index 6d6f698585..41ee41e793 100644 --- a/docs/3.x.x/migration-guide/migration-guide-alpha.9-to-alpha.10.md +++ b/docs/3.x.x/migration-guide/migration-guide-alpha.9-to-alpha.10.md @@ -49,7 +49,7 @@ Delete your old admin folder and replace it by the new one. Copy this file `/plugins/users-permissions/config/jwt.json` **from your old project** and paste it in the corresponding one in your new project. -Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` file in the new one. +Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` and `/plugins/users-permissions/config/jwt.json` file in the new one. Then, delete your old `plugins` folder and replace it by the new one. diff --git a/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/saga.js b/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/saga.js index 3d8f4addb7..a72ff96c22 100644 --- a/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/saga.js +++ b/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/saga.js @@ -37,7 +37,7 @@ export function* submitForm(action) { const response = yield call(request, requestURL, { method: 'POST', body: omit(body, 'news') }); if(get(response, 'user.role.name', '') === 'Administrator' || isRegister){ - + yield call(auth.setToken, response.jwt, body.rememberMe); yield call(auth.setUserInfo, response.user, body.rememberMe); } From a23fe2c307016996eddd03640199d410b3ac3a9d Mon Sep 17 00:00:00 2001 From: Jim LAURIE Date: Sun, 6 Jan 2019 15:17:59 +0100 Subject: [PATCH 20/34] Remove relations route from bookshelf template --- .../strapi-generate-api/json/routes.json.js | 25 ---------------- .../templates/bookshelf/controller.template | 30 ------------------- 2 files changed, 55 deletions(-) diff --git a/packages/strapi-generate-api/json/routes.json.js b/packages/strapi-generate-api/json/routes.json.js index 7f65faf4af..3fba474798 100644 --- a/packages/strapi-generate-api/json/routes.json.js +++ b/packages/strapi-generate-api/json/routes.json.js @@ -64,31 +64,6 @@ module.exports = scope => { }] }; - if (scope.args.tpl && scope.args.tpl !== 'mongoose') { - routes.routes.push({ - method: 'POST', - path: '/' + scope.idPluralized + '/:' + tokenID + '/relationships/:relation', - handler: scope.globalID + '.createRelation', - config: { - policies: [] - } - }, { - method: 'PUT', - path: '/' + scope.idPluralized + '/:' + tokenID + '/relationships/:relation', - handler: scope.globalID + '.updateRelation', - config: { - policies: [] - } - }, { - method: 'DELETE', - path: '/' + scope.idPluralized + '/:' + tokenID + '/relationships/:relation', - handler: scope.globalID + '.destroyRelation', - config: { - policies: [] - } - }); - } - return routes; } diff --git a/packages/strapi-generate-api/templates/bookshelf/controller.template b/packages/strapi-generate-api/templates/bookshelf/controller.template index 48ed7c3a4f..e8da47f529 100644 --- a/packages/strapi-generate-api/templates/bookshelf/controller.template +++ b/packages/strapi-generate-api/templates/bookshelf/controller.template @@ -70,35 +70,5 @@ module.exports = { destroy: async (ctx, next) => { return strapi.services.<%= id %>.remove(ctx.params); - }, - - /** - * Add relation to a/an <%= id %> record. - * - * @return {Object} - */ - - createRelation: async (ctx, next) => { - return strapi.services.<%= id %>.addRelation(ctx.params, ctx.request.body); - }, - - /** - * Update relation to a/an <%= id %> record. - * - * @return {Object} - */ - - updateRelation: async (ctx, next) => { - return strapi.services.<%= id %>.editRelation(ctx.params, ctx.request.body); - }, - - /** - * Destroy relation to a/an <%= id %> record. - * - * @return {Object} - */ - - destroyRelation: async (ctx, next) => { - return strapi.services.<%= id %>.removeRelation(ctx.params, ctx.request.body); } }; From dbd1d68ccc9021d8528b9dafbbd7b7b955851bbe Mon Sep 17 00:00:00 2001 From: invader Date: Mon, 7 Jan 2019 01:26:04 +0300 Subject: [PATCH 21/34] admin: add intl support in Logout component and add ru translations --- .../strapi-admin/admin/src/components/Logout/index.js | 11 +++++++++-- packages/strapi-admin/admin/src/translations/ru.json | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/strapi-admin/admin/src/components/Logout/index.js b/packages/strapi-admin/admin/src/components/Logout/index.js index c97d9a9c35..03c15244a6 100644 --- a/packages/strapi-admin/admin/src/components/Logout/index.js +++ b/packages/strapi-admin/admin/src/components/Logout/index.js @@ -5,6 +5,7 @@ */ import React from 'react'; +import { FormattedMessage } from 'react-intl'; import { get } from 'lodash'; import PropTypes from 'prop-types'; import { ButtonDropdown, DropdownItem, DropdownMenu, DropdownToggle } from 'reactstrap'; @@ -40,10 +41,16 @@ class Logout extends React.Component { // eslint-disable-line react/prefer-state - Profile + - Logout + diff --git a/packages/strapi-admin/admin/src/translations/ru.json b/packages/strapi-admin/admin/src/translations/ru.json index 86ce858d85..240ce0cedd 100644 --- a/packages/strapi-admin/admin/src/translations/ru.json +++ b/packages/strapi-admin/admin/src/translations/ru.json @@ -75,6 +75,8 @@ "app.components.ListPluginsPage.description": "Список установленых плагинов.", "app.components.ListPluginsPage.helmet.title": "Список плагинов", "app.components.ListPluginsPage.title": "Плагины", + "app.components.Logout.profile": "Профиль", + "app.components.Logout.logout": "Выйти", "app.components.NotFoundPage.back": "Вернуться на главную", "app.components.NotFoundPage.description": "Не найдено", "app.components.Official": "Официальный", From 8e87f42289c80d37a6568fa79c65d336e1e1c63b Mon Sep 17 00:00:00 2001 From: invader Date: Mon, 7 Jan 2019 01:56:34 +0300 Subject: [PATCH 22/34] admin: add logout component translation keys to every locale (google translate) --- packages/strapi-admin/admin/src/translations/ar.json | 4 +++- packages/strapi-admin/admin/src/translations/de.json | 2 ++ packages/strapi-admin/admin/src/translations/en.json | 4 +++- packages/strapi-admin/admin/src/translations/es.json | 4 +++- packages/strapi-admin/admin/src/translations/fr.json | 2 ++ packages/strapi-admin/admin/src/translations/it.json | 2 ++ packages/strapi-admin/admin/src/translations/ja.json | 2 ++ packages/strapi-admin/admin/src/translations/ko.json | 4 +++- packages/strapi-admin/admin/src/translations/nl.json | 4 +++- packages/strapi-admin/admin/src/translations/pl.json | 2 ++ packages/strapi-admin/admin/src/translations/pt-BR.json | 2 ++ packages/strapi-admin/admin/src/translations/pt.json | 4 +++- packages/strapi-admin/admin/src/translations/tr.json | 4 +++- packages/strapi-admin/admin/src/translations/zh-Hans.json | 4 +++- packages/strapi-admin/admin/src/translations/zh.json | 4 +++- 15 files changed, 39 insertions(+), 9 deletions(-) diff --git a/packages/strapi-admin/admin/src/translations/ar.json b/packages/strapi-admin/admin/src/translations/ar.json index 6202ac2ee8..434cc5bb7c 100644 --- a/packages/strapi-admin/admin/src/translations/ar.json +++ b/packages/strapi-admin/admin/src/translations/ar.json @@ -75,6 +75,8 @@ "app.components.ListPluginsPage.description": "قائمة الإضافيات المثبتة في المشروع.", "app.components.ListPluginsPage.helmet.title": "قائمة الإضافات", "app.components.ListPluginsPage.title": "الإضافات", + "app.components.Logout.profile": "الملف الشخصي", + "app.components.Logout.logout": "الخروج", "app.components.NotFoundPage.back": "العودة للرئيسية", "app.components.NotFoundPage.description": "لا يوجد", "app.components.Official": "الرسمية", @@ -138,4 +140,4 @@ "notification.error.layout": "تعذّر استرداد التنسيق", "request.error.model.unknow": "هذا النموذج غير موجود", "request.error.model.unknown": "هذا النموذج غير موجود" -} \ No newline at end of file +} diff --git a/packages/strapi-admin/admin/src/translations/de.json b/packages/strapi-admin/admin/src/translations/de.json index 05ecb5c30d..70cc7a304a 100644 --- a/packages/strapi-admin/admin/src/translations/de.json +++ b/packages/strapi-admin/admin/src/translations/de.json @@ -75,6 +75,8 @@ "app.components.LeftMenuLinkContainer.plugins": "Plugins", "app.components.ListPluginsPage.description": "Liste aller im Projekt installierten Plugins.", "app.components.ListPluginsPage.helmet.title": "Plugins anzeigen", + "app.components.Logout.profile": "Profil", + "app.components.Logout.logout": "Ausloggen", "app.components.ListPluginsPage.title": "Plugins", "app.components.NotFoundPage.back": "Zurück zur Homepage", "app.components.NotFoundPage.description": "Nicht gefunden", diff --git a/packages/strapi-admin/admin/src/translations/en.json b/packages/strapi-admin/admin/src/translations/en.json index ed3f265cfe..f54f55f160 100644 --- a/packages/strapi-admin/admin/src/translations/en.json +++ b/packages/strapi-admin/admin/src/translations/en.json @@ -75,6 +75,8 @@ "app.components.ListPluginsPage.description": "List of the installed plugins in the project.", "app.components.ListPluginsPage.helmet.title": "List plugins", "app.components.ListPluginsPage.title": "Plugins", + "app.components.Logout.profile": "Profile", + "app.components.Logout.logout": "Logout", "app.components.NotFoundPage.back": "Back to homepage", "app.components.NotFoundPage.description": "Not Found", "app.components.Official": "Official", @@ -138,4 +140,4 @@ "notification.error.layout": "Couldn't retrieve the layout", "request.error.model.unknown": "This model doesn't exist", "app.utils.delete": "Delete" -} \ No newline at end of file +} diff --git a/packages/strapi-admin/admin/src/translations/es.json b/packages/strapi-admin/admin/src/translations/es.json index d12f1837f6..fb109317e3 100644 --- a/packages/strapi-admin/admin/src/translations/es.json +++ b/packages/strapi-admin/admin/src/translations/es.json @@ -75,6 +75,8 @@ "app.components.ListPluginsPage.description": "Lista de los plugins instalados en el proyecto.", "app.components.ListPluginsPage.helmet.title": "Lista de plugins", "app.components.ListPluginsPage.title": "Plugins", + "app.components.Logout.profile": "Perfil", + "app.components.Logout.logout": "Cerrar sesión", "app.components.NotFoundPage.back": "Volver a la página de inicio", "app.components.NotFoundPage.description": "No encontrado", "app.components.Official": "Oficial", @@ -138,4 +140,4 @@ "notification.error.layout": "No se pudo recuperar el esquema", "request.error.model.unknown": "Este modelo no existe", "app.utils.delete": "Eliminar" -} \ No newline at end of file +} diff --git a/packages/strapi-admin/admin/src/translations/fr.json b/packages/strapi-admin/admin/src/translations/fr.json index 7f002a80e8..8734c39f8c 100644 --- a/packages/strapi-admin/admin/src/translations/fr.json +++ b/packages/strapi-admin/admin/src/translations/fr.json @@ -75,6 +75,8 @@ "app.components.LeftMenuLinkContainer.plugins": "Plugins", "app.components.ListPluginsPage.description": "Liste des plugins installés dans le projet.", "app.components.ListPluginsPage.helmet.title": "List plugins", + "app.components.Logout.profile": "Profil", + "app.components.Logout.logout": "Connectez - Out", "app.components.ListPluginsPage.title": "Plugins", "app.components.NotFoundPage.back": "Retourner à la page d'accueil", "app.components.NotFoundPage.description": "Page introuvable", diff --git a/packages/strapi-admin/admin/src/translations/it.json b/packages/strapi-admin/admin/src/translations/it.json index 6e97e59eca..872f38ee0e 100644 --- a/packages/strapi-admin/admin/src/translations/it.json +++ b/packages/strapi-admin/admin/src/translations/it.json @@ -75,6 +75,8 @@ "app.components.ListPluginsPage.description": "Lista dei plugin installati nel progetto.", "app.components.ListPluginsPage.helmet.title": "Lista plugin", "app.components.ListPluginsPage.title": "Plugins", + "app.components.Logout.profile": "Profilo", + "app.components.Logout.logout": "Disconnettersi", "app.components.NotFoundPage.back": "Torna alla home", "app.components.NotFoundPage.description": "Non trovato", "app.components.Official": "Ufficiale", diff --git a/packages/strapi-admin/admin/src/translations/ja.json b/packages/strapi-admin/admin/src/translations/ja.json index dc940acb2f..4207c7f8b3 100644 --- a/packages/strapi-admin/admin/src/translations/ja.json +++ b/packages/strapi-admin/admin/src/translations/ja.json @@ -75,6 +75,8 @@ "app.components.ListPluginsPage.description": "このプロジェクトでインストールされたプラグイン一覧", "app.components.ListPluginsPage.helmet.title": "プラグイン一覧", "app.components.ListPluginsPage.title": "プラグイン", + "app.components.Logout.profile": "プロフィール", + "app.components.Logout.logout": "ログアウト", "app.components.NotFoundPage.back": "ホームページに戻る", "app.components.NotFoundPage.description": "見つかりません", "app.components.Official": "オフィシャル", diff --git a/packages/strapi-admin/admin/src/translations/ko.json b/packages/strapi-admin/admin/src/translations/ko.json index 50f7c3321b..8fd25623f2 100644 --- a/packages/strapi-admin/admin/src/translations/ko.json +++ b/packages/strapi-admin/admin/src/translations/ko.json @@ -74,6 +74,8 @@ "app.components.ListPluginsPage.description": "이 프로젝트에 설치된 플러그인 목록입니다.", "app.components.ListPluginsPage.helmet.title": "플러그인 목록", "app.components.ListPluginsPage.title": "플러그인", + "app.components.Logout.profile": "옆모습", + "app.components.Logout.logout": "로그 아웃", "app.components.NotFoundPage.back": "홈으로 돌아가기", "app.components.NotFoundPage.description": "찾을 수 없는 페이지입니다.", "app.components.Official": "공식", @@ -136,4 +138,4 @@ "notification.error": "에러가 발생했습니다.", "notification.error.layout": "레이아웃을 가져올 수 없습니다.", "request.error.model.unknown": "모델이 없습니다." -} \ No newline at end of file +} diff --git a/packages/strapi-admin/admin/src/translations/nl.json b/packages/strapi-admin/admin/src/translations/nl.json index aba6364ec7..cc573ccf02 100644 --- a/packages/strapi-admin/admin/src/translations/nl.json +++ b/packages/strapi-admin/admin/src/translations/nl.json @@ -75,6 +75,8 @@ "app.components.ListPluginsPage.description": "Lijst van alle plugins voor dit project", "app.components.ListPluginsPage.helmet.title": "Alle extensies", "app.components.ListPluginsPage.title": "Extensies", + "app.components.Logout.profile": "Profil", + "app.components.Logout.logout": "Log ud", "app.components.NotFoundPage.back": "Terug naar home pagina", "app.components.NotFoundPage.description": "Niets gevonden", "app.components.Official": "Officieel", @@ -137,4 +139,4 @@ "notification.error": "Er is een fout opgetreden", "notification.error.layout": "Kon de opzet niet laden", "request.error.model.unknown": "Dit model bestaat niet" -} \ No newline at end of file +} diff --git a/packages/strapi-admin/admin/src/translations/pl.json b/packages/strapi-admin/admin/src/translations/pl.json index a0f72f429e..521e345e75 100644 --- a/packages/strapi-admin/admin/src/translations/pl.json +++ b/packages/strapi-admin/admin/src/translations/pl.json @@ -75,6 +75,8 @@ "app.components.ListPluginsPage.description": "Lista zainstalowanych wtyczek w projekcie.", "app.components.ListPluginsPage.helmet.title": "Lista wtyczek", "app.components.ListPluginsPage.title": "Wtyczki", + "app.components.Logout.profile": "Profil", + "app.components.Logout.logout": "Wyloguj", "app.components.NotFoundPage.back": "Powrót do strony głównej", "app.components.NotFoundPage.description": "Nie znaleziono", "app.components.Official": "Oficjalna", diff --git a/packages/strapi-admin/admin/src/translations/pt-BR.json b/packages/strapi-admin/admin/src/translations/pt-BR.json index 0c1282247e..f47a81e4d5 100644 --- a/packages/strapi-admin/admin/src/translations/pt-BR.json +++ b/packages/strapi-admin/admin/src/translations/pt-BR.json @@ -75,6 +75,8 @@ "app.components.ListPluginsPage.description": "Lista de extensões instaladas no projeto.", "app.components.ListPluginsPage.helmet.title": "Lista de extensões", "app.components.ListPluginsPage.title": "Extensões", + "app.components.Logout.profile": "Perfil", + "app.components.Logout.logout": "Sair", "app.components.NotFoundPage.back": "Voltar à página inicial", "app.components.NotFoundPage.description": "Não encontrado", "app.components.Official": "Oficial", diff --git a/packages/strapi-admin/admin/src/translations/pt.json b/packages/strapi-admin/admin/src/translations/pt.json index 7e2be79f02..9cbe9da034 100644 --- a/packages/strapi-admin/admin/src/translations/pt.json +++ b/packages/strapi-admin/admin/src/translations/pt.json @@ -75,6 +75,8 @@ "app.components.ListPluginsPage.description": "Lista de extensões instaladas no projecto.", "app.components.ListPluginsPage.helmet.title": "Lista de extensões", "app.components.ListPluginsPage.title": "Extensões", + "app.components.Logout.profile": "Perfil", + "app.components.Logout.logout": "Sair", "app.components.NotFoundPage.back": "Voltar à página inicial", "app.components.NotFoundPage.description": "Não encontrado", "app.components.Official": "Oficial", @@ -137,4 +139,4 @@ "notification.error": "Ocorreu um erro", "notification.error.layout": "Não foi possível recuperar o layout", "request.error.model.unknown": "Este modelo não existe" -} \ No newline at end of file +} diff --git a/packages/strapi-admin/admin/src/translations/tr.json b/packages/strapi-admin/admin/src/translations/tr.json index a617294458..e381ea668a 100644 --- a/packages/strapi-admin/admin/src/translations/tr.json +++ b/packages/strapi-admin/admin/src/translations/tr.json @@ -75,6 +75,8 @@ "app.components.ListPluginsPage.description": "Projedeki yüklenen eklentiler.", "app.components.ListPluginsPage.helmet.title": "Eklenti Listesi", "app.components.ListPluginsPage.title": "Etklentiler", + "app.components.Logout.profile": "Profil", + "app.components.Logout.logout": "Çıkış Yap", "app.components.NotFoundPage.back": "Anasayfaya geri dön", "app.components.NotFoundPage.description": "Bulunamadı", "app.components.Official": "Resmi", @@ -138,4 +140,4 @@ "notification.error.layout": "Düzen alınamadı", "request.error.model.unknown": "Bu model bulunmamaktadır.", "app.utils.delete": "Sil" -} \ No newline at end of file +} diff --git a/packages/strapi-admin/admin/src/translations/zh-Hans.json b/packages/strapi-admin/admin/src/translations/zh-Hans.json index 666d0f9b29..196a24fa43 100644 --- a/packages/strapi-admin/admin/src/translations/zh-Hans.json +++ b/packages/strapi-admin/admin/src/translations/zh-Hans.json @@ -72,6 +72,8 @@ "app.components.ListPluginsPage.description": "项目中已安装的插件列表", "app.components.ListPluginsPage.helmet.title": "插件列表", "app.components.ListPluginsPage.title": "插件", + "app.components.Logout.profile": "轮廓", + "app.components.Logout.logout": "登出", "app.components.NotFoundPage.back": "返回主页", "app.components.NotFoundPage.description": "没有找到", "app.components.Official": "官方", @@ -133,4 +135,4 @@ "notification.error": "发生了一个错误", "notification.error.layout": "无法获取布局", "request.error.model.unknown": "这个模型已不存在" -} \ No newline at end of file +} diff --git a/packages/strapi-admin/admin/src/translations/zh.json b/packages/strapi-admin/admin/src/translations/zh.json index d00b103c4f..8a343ea8e3 100644 --- a/packages/strapi-admin/admin/src/translations/zh.json +++ b/packages/strapi-admin/admin/src/translations/zh.json @@ -75,6 +75,8 @@ "app.components.ListPluginsPage.description": "這個專案安裝的擴充功能列表", "app.components.ListPluginsPage.helmet.title": "擴充功能列表", "app.components.ListPluginsPage.title": "擴充功能", + "app.components.Logout.profile": "輪廓", + "app.components.Logout.logout": "登出", "app.components.NotFoundPage.back": "回到主頁", "app.components.NotFoundPage.description": "找不到此頁面", "app.components.Official": "官方", @@ -138,4 +140,4 @@ "notification.error.layout": "無法取得佈局", "request.error.model.unknown": "不存在的資料", "app.utils.delete": "刪除" -} \ No newline at end of file +} From e34be57d52ba5eb334470d05f9737a2825d96556 Mon Sep 17 00:00:00 2001 From: invader Date: Mon, 7 Jan 2019 02:00:04 +0300 Subject: [PATCH 23/34] admin: AdminPage container - define prop types for getAdminData --- packages/strapi-admin/admin/src/containers/AdminPage/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/strapi-admin/admin/src/containers/AdminPage/index.js b/packages/strapi-admin/admin/src/containers/AdminPage/index.js index 72c6a31ce9..0580bb6dea 100644 --- a/packages/strapi-admin/admin/src/containers/AdminPage/index.js +++ b/packages/strapi-admin/admin/src/containers/AdminPage/index.js @@ -256,6 +256,7 @@ AdminPage.propTypes = { blockApp: PropTypes.bool.isRequired, disableGlobalOverlayBlocker: PropTypes.func.isRequired, enableGlobalOverlayBlocker: PropTypes.func.isRequired, + getAdminData: PropTypes.func.isRequired, hasUserPlugin: PropTypes.bool, history: PropTypes.object.isRequired, isAppLoading: PropTypes.bool, From aba68be9d48476730103c5465f603d0503cd1fab Mon Sep 17 00:00:00 2001 From: invader Date: Mon, 7 Jan 2019 02:03:35 +0300 Subject: [PATCH 24/34] admin: remove defaultMessages in Logout component (now keys defined in all locales) --- .../strapi-admin/admin/src/components/Logout/index.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/packages/strapi-admin/admin/src/components/Logout/index.js b/packages/strapi-admin/admin/src/components/Logout/index.js index 03c15244a6..2f94aabc0a 100644 --- a/packages/strapi-admin/admin/src/components/Logout/index.js +++ b/packages/strapi-admin/admin/src/components/Logout/index.js @@ -41,16 +41,10 @@ class Logout extends React.Component { // eslint-disable-line react/prefer-state - + - + From c660ac57b27bc251abba8dd385498e09c6e79907 Mon Sep 17 00:00:00 2001 From: Trevor Kirpaul Date: Mon, 7 Jan 2019 22:42:40 -0500 Subject: [PATCH 25/34] fixed grammar in Documentation withing the 'guides' section on the 'filters' page --- docs/3.x.x/guides/filters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/3.x.x/guides/filters.md b/docs/3.x.x/guides/filters.md index 262bf885b9..315401fd59 100644 --- a/docs/3.x.x/guides/filters.md +++ b/docs/3.x.x/guides/filters.md @@ -82,7 +82,7 @@ Requests system can be implemented in custom code sections. ### Extracting requests filters -To extract the filters from an JavaScript object or a request, you need to call the [`strapi.utils.models.convertParams` helper](../api-reference/reference.md#strapiutils). +To extract the filters from a JavaScript object or a request, you need to call the [`strapi.utils.models.convertParams` helper](../api-reference/reference.md#strapiutils). ::: note The returned objects are formatted according to the ORM used by the model. From e08d8a2fb15b263854c03c0bc542268e917f84e8 Mon Sep 17 00:00:00 2001 From: DMehaffy Date: Tue, 8 Jan 2019 05:49:28 -0700 Subject: [PATCH 26/34] Update PR Template with database testing checks --- .github/PULL_REQUEST_TEMPLATE.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 0b97e00b61..f8fdeddbf3 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -14,6 +14,13 @@ Main update on the: - [ ] Framework - [ ] Plugin + +Manual testing done on the follow databases: +- [ ] Not applicable +- [ ] MongoDB +- [ ] MySQL +- [ ] Postgres + From e41948de3f997e63db672a14f22a1ba7bb14d4a1 Mon Sep 17 00:00:00 2001 From: Jim LAURIE Date: Wed, 9 Jan 2019 14:19:39 +0100 Subject: [PATCH 27/34] Add setting for production environment --- .../files/config/environments/production/server.json | 1 + .../files/config/environments/staging/server.json | 1 + packages/strapi-plugin-graphql/services/Schema.js | 2 +- .../services/UsersPermissions.js | 2 +- packages/strapi/lib/core/plugins.js | 4 ++-- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/strapi-generate-new/files/config/environments/production/server.json b/packages/strapi-generate-new/files/config/environments/production/server.json index 4e5d9d1b5e..a72d469d48 100644 --- a/packages/strapi-generate-new/files/config/environments/production/server.json +++ b/packages/strapi-generate-new/files/config/environments/production/server.json @@ -1,6 +1,7 @@ { "host": "localhost", "port": "${process.env.PORT || 1337}", + "production": true, "proxy": { "enabled": false }, diff --git a/packages/strapi-generate-new/files/config/environments/staging/server.json b/packages/strapi-generate-new/files/config/environments/staging/server.json index 4e5d9d1b5e..a72d469d48 100644 --- a/packages/strapi-generate-new/files/config/environments/staging/server.json +++ b/packages/strapi-generate-new/files/config/environments/staging/server.json @@ -1,6 +1,7 @@ { "host": "localhost", "port": "${process.env.PORT || 1337}", + "production": true, "proxy": { "enabled": false }, diff --git a/packages/strapi-plugin-graphql/services/Schema.js b/packages/strapi-plugin-graphql/services/Schema.js index dcb8a29949..dc5d28261b 100644 --- a/packages/strapi-plugin-graphql/services/Schema.js +++ b/packages/strapi-plugin-graphql/services/Schema.js @@ -266,7 +266,7 @@ module.exports = { resolvers, }); - if (strapi.config.environment === 'development') { + if (!strapi.config.currentEnvironment.server.production) { // Write schema. this.writeGenerateSchema(graphql.printSchema(schema)); } diff --git a/packages/strapi-plugin-users-permissions/services/UsersPermissions.js b/packages/strapi-plugin-users-permissions/services/UsersPermissions.js index 35ed7cfdf6..6df284bd8e 100644 --- a/packages/strapi-plugin-users-permissions/services/UsersPermissions.js +++ b/packages/strapi-plugin-users-permissions/services/UsersPermissions.js @@ -438,7 +438,7 @@ module.exports = { try { // Disable auto-reload. strapi.reload.isWatching = false; - if (strapi.config.environment === 'development') { + if (!strapi.config.currentEnvironment.server.production) { // Rewrite actions.json file. fs.writeFileSync(actionsPath, JSON.stringify({ actions: data }), 'utf8'); } diff --git a/packages/strapi/lib/core/plugins.js b/packages/strapi/lib/core/plugins.js index 04e8b10625..a22cf4dfec 100644 --- a/packages/strapi/lib/core/plugins.js +++ b/packages/strapi/lib/core/plugins.js @@ -89,9 +89,9 @@ module.exports = async function() { } const existBuildPath = await fs.pathExists(buildPath); - if (strapi.config.environment !== 'development' && existBuildPath) { + if (strapi.config.currentEnvironment.server.production && existBuildPath) { return; - } else if (strapi.config.environment !== 'development' && !existBuildPath) { + } else if (strapi.config.currentEnvironment.server.production && !existBuildPath) { console.log('The plugins.json file is missing and the front-end cannot work without it. Please, create it first at development environment.'); } From 934d2a3739b37c33f06165a250130215e604e42f Mon Sep 17 00:00:00 2001 From: Pierre Burgy Date: Thu, 10 Jan 2019 16:11:58 +0100 Subject: [PATCH 28/34] Add Documentation and Help links --- .../src/components/LeftMenuFooter/index.js | 20 +++++++++++++-- .../components/LeftMenuFooter/messages.json | 8 ++++++ .../src/components/LeftMenuFooter/styles.scss | 21 +++++++++------- .../src/components/LeftMenuLink/index.js | 25 ++++++++++++++++--- .../LeftMenuLinkContainer/styles.scss | 1 + .../admin/src/containers/AdminPage/index.js | 1 + .../admin/src/translations/en.json | 2 ++ .../admin/src/translations/fr.json | 2 ++ 8 files changed, 66 insertions(+), 14 deletions(-) diff --git a/packages/strapi-admin/admin/src/components/LeftMenuFooter/index.js b/packages/strapi-admin/admin/src/components/LeftMenuFooter/index.js index fda0e7abc4..c1957b2a08 100644 --- a/packages/strapi-admin/admin/src/components/LeftMenuFooter/index.js +++ b/packages/strapi-admin/admin/src/components/LeftMenuFooter/index.js @@ -8,6 +8,8 @@ import React from 'react'; import { defineMessages, FormattedMessage } from 'react-intl'; import { PropTypes } from 'prop-types'; +import LeftMenuLink from 'components/LeftMenuLink'; + import styles from './styles.scss'; import messages from './messages.json'; defineMessages(messages); @@ -15,8 +17,22 @@ defineMessages(messages); function LeftMenuFooter({ version }) { // eslint-disable-line react/prefer-stateless-function return (
- - v{version} +
    + + +
+
+ + v{version} +
); } diff --git a/packages/strapi-admin/admin/src/components/LeftMenuFooter/messages.json b/packages/strapi-admin/admin/src/components/LeftMenuFooter/messages.json index 1259c5c559..6db35356c0 100644 --- a/packages/strapi-admin/admin/src/components/LeftMenuFooter/messages.json +++ b/packages/strapi-admin/admin/src/components/LeftMenuFooter/messages.json @@ -1,4 +1,12 @@ { + "documentation": { + "id": "app.components.LeftMenuFooter.documentation", + "defaultMessage": "Documentation" + }, + "help": { + "id": "app.components.LeftMenuFooter.help", + "defaultMessage": "Help" + }, "poweredBy": { "id": "app.components.LeftMenuFooter.poweredBy", "defaultMessage": "Proudly powered by " diff --git a/packages/strapi-admin/admin/src/components/LeftMenuFooter/styles.scss b/packages/strapi-admin/admin/src/components/LeftMenuFooter/styles.scss index ad1f464c5d..b75b326c92 100644 --- a/packages/strapi-admin/admin/src/components/LeftMenuFooter/styles.scss +++ b/packages/strapi-admin/admin/src/components/LeftMenuFooter/styles.scss @@ -3,6 +3,18 @@ .leftMenuFooter { /* stylelint-disable */ position: absolute; + width: 100%; + background: $left-menu-bg; + bottom: 0; +} + +.list { + list-style: none; + padding: 0; + margin-bottom: 0; +} + +.poweredBy { width: 100%; display: flex; justify-content: space-between; @@ -11,19 +23,10 @@ padding-left: 15px; padding-right: 15px; line-height: 3rem; - font-family: 'Lato'; background-color: rgba(255, 255, 255, .02); font-size: 1rem; font-weight: 400; letter-spacing: 0.05rem; vertical-align: middle; color: $strapi-gray-light; - - a { - color: #0097f7; - } - - select{ - outline: none; - } } diff --git a/packages/strapi-admin/admin/src/components/LeftMenuLink/index.js b/packages/strapi-admin/admin/src/components/LeftMenuLink/index.js index d37f84e0bc..3ee932c32c 100644 --- a/packages/strapi-admin/admin/src/components/LeftMenuLink/index.js +++ b/packages/strapi-admin/admin/src/components/LeftMenuLink/index.js @@ -47,8 +47,22 @@ class LeftMenuLink extends React.Component { {this.props.label} ); - return ( -
  • + // Icon. + const icon = ; + + // Create external or internal link. + const link = this.props.destination.includes('http') + ? ( + + {icon} + {content} + + ) + : ( - + {icon} {content} + ); + + return ( +
  • + {link} {plugin}
  • ); diff --git a/packages/strapi-admin/admin/src/components/LeftMenuLinkContainer/styles.scss b/packages/strapi-admin/admin/src/components/LeftMenuLinkContainer/styles.scss index bdf52d6f93..ac571ffbea 100644 --- a/packages/strapi-admin/admin/src/components/LeftMenuLinkContainer/styles.scss +++ b/packages/strapi-admin/admin/src/components/LeftMenuLinkContainer/styles.scss @@ -3,6 +3,7 @@ .leftMenuLinkContainer { /* stylelint-ignore */ padding-top: .6rem; + padding-bottom: 10.2rem; // LeftMenuFooter height position: absolute; top: 60px; right: 0; diff --git a/packages/strapi-admin/admin/src/containers/AdminPage/index.js b/packages/strapi-admin/admin/src/containers/AdminPage/index.js index 72c6a31ce9..0580bb6dea 100644 --- a/packages/strapi-admin/admin/src/containers/AdminPage/index.js +++ b/packages/strapi-admin/admin/src/containers/AdminPage/index.js @@ -256,6 +256,7 @@ AdminPage.propTypes = { blockApp: PropTypes.bool.isRequired, disableGlobalOverlayBlocker: PropTypes.func.isRequired, enableGlobalOverlayBlocker: PropTypes.func.isRequired, + getAdminData: PropTypes.func.isRequired, hasUserPlugin: PropTypes.bool, history: PropTypes.object.isRequired, isAppLoading: PropTypes.bool, diff --git a/packages/strapi-admin/admin/src/translations/en.json b/packages/strapi-admin/admin/src/translations/en.json index ed3f265cfe..a2f0084ee1 100644 --- a/packages/strapi-admin/admin/src/translations/en.json +++ b/packages/strapi-admin/admin/src/translations/en.json @@ -65,6 +65,8 @@ "app.components.InstallPluginPopup.navLink.faq": "faq", "app.components.InstallPluginPopup.navLink.screenshots": "Screenshots", "app.components.InstallPluginPopup.noDescription": "No description available", + "app.components.LeftMenuFooter.documentation": "Documentation", + "app.components.LeftMenuFooter.help": "Help", "app.components.LeftMenuFooter.poweredBy": "Powered by ", "app.components.LeftMenuLinkContainer.configuration": "Configurations", "app.components.LeftMenuLinkContainer.general": "General", diff --git a/packages/strapi-admin/admin/src/translations/fr.json b/packages/strapi-admin/admin/src/translations/fr.json index 7f002a80e8..eb3762d3df 100644 --- a/packages/strapi-admin/admin/src/translations/fr.json +++ b/packages/strapi-admin/admin/src/translations/fr.json @@ -66,6 +66,8 @@ "app.components.InstallPluginPopup.navLink.faq": "FAQ", "app.components.InstallPluginPopup.navLink.screenshots": "Captures d'écran", "app.components.InstallPluginPopup.noDescription": "Aucune description disponible", + "app.components.LeftMenuFooter.documentation": "Documentation", + "app.components.LeftMenuFooter.help": "Aide", "app.components.LeftMenuFooter.poweredBy": "Propulsé par ", "app.components.LeftMenuLinkContainer.configuration": "Configurations", "app.components.LeftMenuLinkContainer.general": "Général", From 1533657015fecb0e28bbb6b08ef1524302e894fd Mon Sep 17 00:00:00 2001 From: Pierre Burgy Date: Thu, 10 Jan 2019 16:41:13 +0100 Subject: [PATCH 29/34] Add Strapi in powered by sentence --- .../strapi-admin/admin/src/components/LeftMenuFooter/index.js | 2 +- .../admin/src/components/LeftMenuFooter/styles.scss | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/strapi-admin/admin/src/components/LeftMenuFooter/index.js b/packages/strapi-admin/admin/src/components/LeftMenuFooter/index.js index c1957b2a08..ec6f44ca77 100644 --- a/packages/strapi-admin/admin/src/components/LeftMenuFooter/index.js +++ b/packages/strapi-admin/admin/src/components/LeftMenuFooter/index.js @@ -31,7 +31,7 @@ function LeftMenuFooter({ version }) { // eslint-disable-line react/prefer-state ); diff --git a/packages/strapi-admin/admin/src/components/LeftMenuFooter/styles.scss b/packages/strapi-admin/admin/src/components/LeftMenuFooter/styles.scss index b75b326c92..e4d6360667 100644 --- a/packages/strapi-admin/admin/src/components/LeftMenuFooter/styles.scss +++ b/packages/strapi-admin/admin/src/components/LeftMenuFooter/styles.scss @@ -16,8 +16,6 @@ .poweredBy { width: 100%; - display: flex; - justify-content: space-between; bottom: 0; height: 3rem; padding-left: 15px; From dedd2551c16d08e2f888a0307bee931c26a18993 Mon Sep 17 00:00:00 2001 From: Jim LAURIE Date: Thu, 10 Jan 2019 16:45:02 +0100 Subject: [PATCH 30/34] Add mongo support --- docs/3.x.x/guides/models.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/3.x.x/guides/models.md b/docs/3.x.x/guides/models.md index 48e4664901..5a3b250093 100644 --- a/docs/3.x.x/guides/models.md +++ b/docs/3.x.x/guides/models.md @@ -56,7 +56,7 @@ If you're using SQL databases, you should use the native SQL constraints to appl - `required` (boolean) — if true adds a required validator for this property. - `unique` (boolean) — whether to define a unique index on this property. - - `index` (boolean) — adds an index on this property, this will create a [single field index](https://docs.mongodb.com/manual/indexes/#single-field) that will run in the background. + - `index` (boolean) — adds an index on this property, this will create a [single field index](https://docs.mongodb.com/manual/indexes/#single-field) that will run in the background (*only supported by MongoDB*). - `max` (integer) — checks if the value is greater than or equal to the given minimum. - `min` (integer) — checks if the value is less than or equal to the given maximum. From b6fc2682971f3adf1dab44bcd15688efe484150e Mon Sep 17 00:00:00 2001 From: Paolo Ragone Date: Fri, 11 Jan 2019 22:52:28 +1300 Subject: [PATCH 31/34] Fixed bug following recommendation --- .../services/Providers.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/packages/strapi-plugin-users-permissions/services/Providers.js b/packages/strapi-plugin-users-permissions/services/Providers.js index a281b8b4d7..34291a4f38 100644 --- a/packages/strapi-plugin-users-permissions/services/Providers.js +++ b/packages/strapi-plugin-users-permissions/services/Providers.js @@ -45,14 +45,9 @@ exports.connect = (provider, query) => { } try { - const users = await strapi.query('user', 'users-permissions').find({ - where: { - email: { - symbol: '=', - value: profile.email - } - } - }); + const users = await strapi.query('user', 'users-permissions').find(strapi.utils.models.convertParams('user', { + email: profile.email + })); const advanced = await strapi.store({ environment: '', From 4bffe2749ca1fe08734ce0872ba778a15577b3bd Mon Sep 17 00:00:00 2001 From: Jim LAURIE Date: Fri, 11 Jan 2019 10:55:21 +0100 Subject: [PATCH 32/34] Remove error log We will work on a complete logs tag plan in the future. --- packages/strapi-plugin-users-permissions/services/Providers.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/strapi-plugin-users-permissions/services/Providers.js b/packages/strapi-plugin-users-permissions/services/Providers.js index 34291a4f38..4c2f28533e 100644 --- a/packages/strapi-plugin-users-permissions/services/Providers.js +++ b/packages/strapi-plugin-users-permissions/services/Providers.js @@ -83,7 +83,6 @@ exports.connect = (provider, query) => { return resolve([createdUser, null]); } catch (err) { - strapi.log.error(err); reject([null, err]); } }); From 1688641bc7834edafc6277cf993f4f01b34f8e35 Mon Sep 17 00:00:00 2001 From: Jim LAURIE Date: Fri, 11 Jan 2019 12:46:14 +0100 Subject: [PATCH 33/34] Update style --- .github/PULL_REQUEST_TEMPLATE.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index f8fdeddbf3..eeda5718dd 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -2,25 +2,26 @@ -My PR is a: +**My PR is a:** - [ ] 💥 Breaking change - [ ] 🐛 Bug fix #issueNumber - [ ] 💅 Enhancement - [ ] 🚀 New feature -Main update on the: +**Main update on the:** - [ ] Admin - [ ] Documentation - [ ] Framework - [ ] Plugin -Manual testing done on the follow databases: +**Manual testing done on the follow databases:** - [ ] Not applicable - [ ] MongoDB - [ ] MySQL - [ ] Postgres +**Description:** From 0b5421dc29ed349ba10ec84273dac28370316214 Mon Sep 17 00:00:00 2001 From: AndroAmater Date: Sat, 12 Jan 2019 19:12:46 +0100 Subject: [PATCH 34/34] Update graphql.md "Lower than or equal to" repeats twice so on line 197 it says "`_gte`: Lower than or equal to. --- docs/3.x.x/guides/graphql.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/3.x.x/guides/graphql.md b/docs/3.x.x/guides/graphql.md index e2c120af41..48dfa1752f 100644 --- a/docs/3.x.x/guides/graphql.md +++ b/docs/3.x.x/guides/graphql.md @@ -194,7 +194,7 @@ You can also apply different parameters to the query to make more complex querie - `_lt`: Lower than. - `_lte`: Lower than or equal to. - `_gt`: Greater than. - - `_gte`: Lower than or equal to. + - `_gte`: Greater than or equal to. - `_contains`: Contains. - `_containss`: Contains sensitive.