From 0408368481d0175eda8242539dfc42ed08115084 Mon Sep 17 00:00:00 2001 From: Okaris Date: Tue, 15 May 2018 21:40:17 +0300 Subject: [PATCH 01/17] Added oneWay relation option on frontend --- .../admin/src/assets/images/one_way.svg | 20 +++++++++++++++++++ .../src/assets/images/one_way_selected.svg | 20 +++++++++++++++++++ .../admin/src/components/RelationBox/index.js | 1 + .../components/RelationNaturePicker/index.js | 9 +++++++++ .../admin/src/containers/Form/index.js | 7 +++++++ .../admin/src/translations/en.json | 3 ++- .../admin/src/translations/tr.json | 1 + 7 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 packages/strapi-plugin-content-type-builder/admin/src/assets/images/one_way.svg create mode 100644 packages/strapi-plugin-content-type-builder/admin/src/assets/images/one_way_selected.svg diff --git a/packages/strapi-plugin-content-type-builder/admin/src/assets/images/one_way.svg b/packages/strapi-plugin-content-type-builder/admin/src/assets/images/one_way.svg new file mode 100644 index 0000000000..567eefedfd --- /dev/null +++ b/packages/strapi-plugin-content-type-builder/admin/src/assets/images/one_way.svg @@ -0,0 +1,20 @@ + + + + Untitled 2 + Created with Sketch. + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/strapi-plugin-content-type-builder/admin/src/assets/images/one_way_selected.svg b/packages/strapi-plugin-content-type-builder/admin/src/assets/images/one_way_selected.svg new file mode 100644 index 0000000000..c213020ce5 --- /dev/null +++ b/packages/strapi-plugin-content-type-builder/admin/src/assets/images/one_way_selected.svg @@ -0,0 +1,20 @@ + + + + Untitled 3 + Created with Sketch. + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/strapi-plugin-content-type-builder/admin/src/components/RelationBox/index.js b/packages/strapi-plugin-content-type-builder/admin/src/components/RelationBox/index.js index cdbfe94c71..62cf93cf5e 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/components/RelationBox/index.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/components/RelationBox/index.js @@ -107,6 +107,7 @@ class RelationBox extends React.Component { // eslint-disable-line react/prefer- const content = isEmpty(this.props.input) ?
: Date: Thu, 17 May 2018 11:27:39 +0300 Subject: [PATCH 02/17] =?UTF-8?q?Fixed=20=E2=80=98oneWay=E2=80=99=20relati?= =?UTF-8?q?on=20creating=20unnecessary=20attr?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When ‘oneWay’ relation is created the target model file is also updated with a reference to the relation. This is not required for a oneWay relation since it never will or can be populated from the other way around. --- packages/strapi-bookshelf/package.json | 2 +- packages/strapi-ejs/package.json | 2 +- packages/strapi-generate-api/package.json | 2 +- packages/strapi-generate-controller/package.json | 2 +- packages/strapi-generate-model/package.json | 2 +- packages/strapi-generate-new/package.json | 2 +- packages/strapi-generate-plugin/package.json | 2 +- packages/strapi-generate-policy/package.json | 2 +- packages/strapi-generate-service/package.json | 2 +- .../services/ContentTypeBuilder.js | 7 ++++++- 10 files changed, 15 insertions(+), 10 deletions(-) diff --git a/packages/strapi-bookshelf/package.json b/packages/strapi-bookshelf/package.json index 3c021f12cf..f6ac237dc0 100755 --- a/packages/strapi-bookshelf/package.json +++ b/packages/strapi-bookshelf/package.json @@ -56,4 +56,4 @@ "npm": ">= 5.3.0" }, "license": "MIT" -} +} \ No newline at end of file diff --git a/packages/strapi-ejs/package.json b/packages/strapi-ejs/package.json index 79ad470d68..6ea7c1d521 100755 --- a/packages/strapi-ejs/package.json +++ b/packages/strapi-ejs/package.json @@ -46,4 +46,4 @@ "npm": ">= 5.3.0" }, "license": "MIT" -} +} \ No newline at end of file diff --git a/packages/strapi-generate-api/package.json b/packages/strapi-generate-api/package.json index 6c4503d694..6eec286e8c 100755 --- a/packages/strapi-generate-api/package.json +++ b/packages/strapi-generate-api/package.json @@ -43,4 +43,4 @@ "npm": ">= 5.3.0" }, "license": "MIT" -} +} \ No newline at end of file diff --git a/packages/strapi-generate-controller/package.json b/packages/strapi-generate-controller/package.json index 9fbb57529c..b0962072e6 100755 --- a/packages/strapi-generate-controller/package.json +++ b/packages/strapi-generate-controller/package.json @@ -43,4 +43,4 @@ "npm": ">= 5.3.0" }, "license": "MIT" -} +} \ No newline at end of file diff --git a/packages/strapi-generate-model/package.json b/packages/strapi-generate-model/package.json index 98e1770504..8ecc5fb06e 100755 --- a/packages/strapi-generate-model/package.json +++ b/packages/strapi-generate-model/package.json @@ -43,4 +43,4 @@ "npm": ">= 5.3.0" }, "license": "MIT" -} +} \ No newline at end of file diff --git a/packages/strapi-generate-new/package.json b/packages/strapi-generate-new/package.json index 860464b1bf..2f8483b152 100755 --- a/packages/strapi-generate-new/package.json +++ b/packages/strapi-generate-new/package.json @@ -48,4 +48,4 @@ "npm": ">= 5.3.0" }, "license": "MIT" -} +} \ No newline at end of file diff --git a/packages/strapi-generate-plugin/package.json b/packages/strapi-generate-plugin/package.json index 32523b026d..36d0158da3 100755 --- a/packages/strapi-generate-plugin/package.json +++ b/packages/strapi-generate-plugin/package.json @@ -44,4 +44,4 @@ "npm": ">= 5.3.0" }, "license": "MIT" -} +} \ No newline at end of file diff --git a/packages/strapi-generate-policy/package.json b/packages/strapi-generate-policy/package.json index bfb15c1900..e0bf3a54c6 100755 --- a/packages/strapi-generate-policy/package.json +++ b/packages/strapi-generate-policy/package.json @@ -43,4 +43,4 @@ "npm": ">= 5.3.0" }, "license": "MIT" -} +} \ No newline at end of file diff --git a/packages/strapi-generate-service/package.json b/packages/strapi-generate-service/package.json index 265eb7230b..72fbf77b4e 100755 --- a/packages/strapi-generate-service/package.json +++ b/packages/strapi-generate-service/package.json @@ -43,4 +43,4 @@ "npm": ">= 5.3.0" }, "license": "MIT" -} +} \ No newline at end of file diff --git a/packages/strapi-plugin-content-type-builder/services/ContentTypeBuilder.js b/packages/strapi-plugin-content-type-builder/services/ContentTypeBuilder.js index cbffcb7bf1..6506d28eff 100755 --- a/packages/strapi-plugin-content-type-builder/services/ContentTypeBuilder.js +++ b/packages/strapi-plugin-content-type-builder/services/ContentTypeBuilder.js @@ -201,6 +201,7 @@ module.exports = { }; switch (relation.nature) { + case 'oneWay': case 'oneToOne': case 'manyToOne': attr.model = relation.target; @@ -212,7 +213,9 @@ module.exports = { default: } - attr.via = relation.key; + if(relation.nature !== 'oneWay') { + attr.via = relation.key; + } attr.dominant = relation.dominant; if (_.trim(relation.pluginValue)) { @@ -353,6 +356,8 @@ module.exports = { const attr = {}; switch (params.nature) { + case 'oneWay': + return; case 'oneToOne': case 'oneToMany': attr.model = model.toLowerCase(); From 0d5e657a5a6cdfb7bbcbab9dcf849576e95d590d Mon Sep 17 00:00:00 2001 From: Okaris Date: Thu, 17 May 2018 12:41:04 +0300 Subject: [PATCH 03/17] Fixed relation picker icon padding --- .../admin/src/components/PopUpForm/styles.scss | 2 +- .../admin/src/components/RelationNaturePicker/styles.scss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/strapi-plugin-content-type-builder/admin/src/components/PopUpForm/styles.scss b/packages/strapi-plugin-content-type-builder/admin/src/components/PopUpForm/styles.scss index 0d7e2fb8cc..c999360b9e 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/components/PopUpForm/styles.scss +++ b/packages/strapi-plugin-content-type-builder/admin/src/components/PopUpForm/styles.scss @@ -1,7 +1,7 @@ /* stylelint-disable */ .contentType, .attribute, .attributes { > div { - width: 74.5rem; + width: 78.5rem; } } diff --git a/packages/strapi-plugin-content-type-builder/admin/src/components/RelationNaturePicker/styles.scss b/packages/strapi-plugin-content-type-builder/admin/src/components/RelationNaturePicker/styles.scss index 4ad1a837de..7392c3b683 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/components/RelationNaturePicker/styles.scss +++ b/packages/strapi-plugin-content-type-builder/admin/src/components/RelationNaturePicker/styles.scss @@ -1,6 +1,6 @@ .relationNaturePicker { /* stylelint-disable */ display: flex; - width: 25.5rem; + width: 29.5rem; position: relative; padding-top: 4.5rem; padding-left: 25px; From 09cff64c5db1c1f58bd651f6d2f96963618d0fe2 Mon Sep 17 00:00:00 2001 From: Johann Pinson Date: Mon, 21 May 2018 15:25:26 +0200 Subject: [PATCH 04/17] fix(graphql): update Union type creation rules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit My PR is a: 🐛 Bug fix Main update on the: Plugin Fix error type `Union type Morph can only include Object types, it cannot include [Enum name]` --- packages/strapi-plugin-graphql/services/GraphQL.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/strapi-plugin-graphql/services/GraphQL.js b/packages/strapi-plugin-graphql/services/GraphQL.js index e0d4ebd5b2..12afa9d2c4 100644 --- a/packages/strapi-plugin-graphql/services/GraphQL.js +++ b/packages/strapi-plugin-graphql/services/GraphQL.js @@ -698,7 +698,7 @@ module.exports = { addPolymorphicUnionType: (customDefs, defs) => { const types = graphql.parse(customDefs + defs).definitions - .filter(def => def.name.value !== 'Query') + .filter(def => && def.kind === 'ObjectTypeDefinition' && def.name.value !== 'Query') .map(def => def.name.value); return { From 330aac40efe4b585669ed4cccded56460a608ec6 Mon Sep 17 00:00:00 2001 From: Johann Pinson Date: Mon, 21 May 2018 15:39:45 +0200 Subject: [PATCH 05/17] fix(graphql): update Union type creation rules --- .../strapi-plugin-graphql/services/GraphQL.js | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/strapi-plugin-graphql/services/GraphQL.js b/packages/strapi-plugin-graphql/services/GraphQL.js index 12afa9d2c4..f67d70b0ff 100644 --- a/packages/strapi-plugin-graphql/services/GraphQL.js +++ b/packages/strapi-plugin-graphql/services/GraphQL.js @@ -33,7 +33,7 @@ module.exports = { return lines .map(line => { if (['{', '}'].includes(line)) { - return ``; + return ''; } const split = line.split(':'); @@ -61,7 +61,7 @@ module.exports = { return lines .map((line, index) => { if (['{', '}'].includes(line)) { - return ``; + return ''; } const split = Object.keys(fields)[index - 1].split('('); @@ -90,7 +90,7 @@ module.exports = { return lines .map((line, index) => { if ([0, lines.length - 1].includes(index)) { - return ``; + return ''; } return line; @@ -105,9 +105,9 @@ module.exports = { */ getDescription: (description, model = {}) => { - const format = `"""\n`; + const format = '"""\n'; - const str = _.get(description, `_description`) || + const str = _.get(description, '_description') || _.isString(description) ? description : undefined || _.get(model, 'info.description'); @@ -115,7 +115,7 @@ module.exports = { return `${format}${str}\n${format}`; } - return ``; + return ''; }, convertToParams: (params) => { @@ -167,7 +167,7 @@ module.exports = { return globalId; } - return definition.model ? `Morph` : `[Morph]`; + return definition.model ? 'Morph' : '[Morph]'; }, /** @@ -380,7 +380,7 @@ module.exports = { // Retrieve generic service from the Content Manager plugin. const resolvers = strapi.plugins['content-manager'].services['contentmanager']; - const initialState = { definition: ``, query: {}, resolver: { Query : {} } }; + const initialState = { definition: '', query: {}, resolver: { Query : {} } }; if (_.isEmpty(models)) { return initialState; @@ -398,7 +398,7 @@ module.exports = { }; const globalId = model.globalId; - const _schema = _.cloneDeep(_.get(strapi.plugins, `graphql.config._schema.graphql`, {})); + const _schema = _.cloneDeep(_.get(strapi.plugins, 'graphql.config._schema.graphql', {})); if (!acc.resolver[globalId]) { acc.resolver[globalId] = {}; @@ -614,7 +614,7 @@ module.exports = { const { definition, query, resolver } = this.shadowCRUD(Object.keys(strapi.plugins[plugin].models), plugin); // We cannot put this in the merge because it's a string. - acc.definition += definition || ``; + acc.definition += definition || ''; return _.merge(acc, { query, @@ -687,7 +687,7 @@ module.exports = { JSON: GraphQLJSON }); - return `scalar JSON`; + return 'scalar JSON'; }, /** @@ -698,7 +698,7 @@ module.exports = { addPolymorphicUnionType: (customDefs, defs) => { const types = graphql.parse(customDefs + defs).definitions - .filter(def => && def.kind === 'ObjectTypeDefinition' && def.name.value !== 'Query') + .filter(def => def.kind === 'ObjectTypeDefinition' && def.name.value !== 'Query') .map(def => def.name.value); return { From 262182fd00e80db30a21343fe1ec2d87a3b61b5f Mon Sep 17 00:00:00 2001 From: Raul Riera Date: Mon, 21 May 2018 14:14:09 -0400 Subject: [PATCH 06/17] Fix a typo in the error key --- packages/strapi-admin/admin/src/translations/de.json | 2 +- packages/strapi-admin/admin/src/translations/en.json | 2 +- packages/strapi-admin/admin/src/translations/fr.json | 2 +- packages/strapi-admin/admin/src/translations/pl.json | 2 +- packages/strapi-admin/admin/src/translations/ru.json | 2 +- packages/strapi-admin/admin/src/translations/tr.json | 2 +- packages/strapi-admin/admin/src/translations/zh-Hans.json | 2 +- packages/strapi-admin/admin/src/translations/zh.json | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/strapi-admin/admin/src/translations/de.json b/packages/strapi-admin/admin/src/translations/de.json index a9548cafab..42893def0c 100644 --- a/packages/strapi-admin/admin/src/translations/de.json +++ b/packages/strapi-admin/admin/src/translations/de.json @@ -130,5 +130,5 @@ "ResetPasswordToken": "Passwort-Token zurücksetzen", "Role": "Rolle", "New entry": "Neuer Eintrag", - "request.error.model.unknow": "Dieses Schema existiert nicht" + "request.error.model.unknown": "Dieses Schema existiert nicht" } diff --git a/packages/strapi-admin/admin/src/translations/en.json b/packages/strapi-admin/admin/src/translations/en.json index 852ef06794..80cdef919f 100755 --- a/packages/strapi-admin/admin/src/translations/en.json +++ b/packages/strapi-admin/admin/src/translations/en.json @@ -156,7 +156,7 @@ "ResetPasswordToken": "Reset Password Token", "Role": "Role", "New entry": "New entry", - "request.error.model.unknow": "This model doesn't exist", + "request.error.model.unknown": "This model doesn't exist", "Users": "Users", "Analytics": "Analytics" } diff --git a/packages/strapi-admin/admin/src/translations/fr.json b/packages/strapi-admin/admin/src/translations/fr.json index d54d755619..f577daa271 100755 --- a/packages/strapi-admin/admin/src/translations/fr.json +++ b/packages/strapi-admin/admin/src/translations/fr.json @@ -154,5 +154,5 @@ "ResetPasswordToken": "ResetPasswordToken", "Role": "Rôle", "New entry": "Nouvelle entrée", - "request.error.model.unknow": "Le model n'existe pas" + "request.error.model.unknown": "Le model n'existe pas" } diff --git a/packages/strapi-admin/admin/src/translations/pl.json b/packages/strapi-admin/admin/src/translations/pl.json index b1d5945d0b..7a84869cce 100644 --- a/packages/strapi-admin/admin/src/translations/pl.json +++ b/packages/strapi-admin/admin/src/translations/pl.json @@ -133,5 +133,5 @@ "ResetPasswordToken": "Token resetu hasła", "Role": "Rola", "New entry": "Nowy wpis", - "request.error.model.unknow": "Ten model nie istnieje" + "request.error.model.unknown": "Ten model nie istnieje" } diff --git a/packages/strapi-admin/admin/src/translations/ru.json b/packages/strapi-admin/admin/src/translations/ru.json index 0a27ddbfc7..b479e2f0d1 100644 --- a/packages/strapi-admin/admin/src/translations/ru.json +++ b/packages/strapi-admin/admin/src/translations/ru.json @@ -153,7 +153,7 @@ "ResetPasswordToken": "Сбросить токен пароля", "Role": "Роль", "New entry": "Новая запись", - "request.error.model.unknow": "Модель данных не существует", + "request.error.model.unknown": "Модель данных не существует", "Users": "Пользователи", "Analytics": "Аналитика" } diff --git a/packages/strapi-admin/admin/src/translations/tr.json b/packages/strapi-admin/admin/src/translations/tr.json index 37f7d69319..6d54e48144 100755 --- a/packages/strapi-admin/admin/src/translations/tr.json +++ b/packages/strapi-admin/admin/src/translations/tr.json @@ -156,7 +156,7 @@ "ResetPasswordToken": "Şifre sıfırlama anahtarı", "Role": "Rol", "New entry": "Yeni kayıt", - "request.error.model.unknow": "Bu model bulunmamaktadır.", + "request.error.model.unknown": "Bu model bulunmamaktadır.", "Users": "Kullanıcılar", "Analytics": "Analizler" } diff --git a/packages/strapi-admin/admin/src/translations/zh-Hans.json b/packages/strapi-admin/admin/src/translations/zh-Hans.json index e1f62e8935..1edd3bc6e4 100644 --- a/packages/strapi-admin/admin/src/translations/zh-Hans.json +++ b/packages/strapi-admin/admin/src/translations/zh-Hans.json @@ -156,7 +156,7 @@ "ResetPasswordToken": "密码重置", "Role": "角色", "New entry": "新入口", - "request.error.model.unknow": "这个模型已不存在", + "request.error.model.unknown": "这个模型已不存在", "Users": "用户", "Analytics": "分析" } diff --git a/packages/strapi-admin/admin/src/translations/zh.json b/packages/strapi-admin/admin/src/translations/zh.json index bb2f7ab521..e851c9fa72 100755 --- a/packages/strapi-admin/admin/src/translations/zh.json +++ b/packages/strapi-admin/admin/src/translations/zh.json @@ -136,5 +136,5 @@ "ResetPasswordToken": "重設密碼的 Token", "Role": "權限", "New entry": "新入口", - "request.error.model.unknow": "這個資料不存在" + "request.error.model.unknown": "這個資料不存在" } From 0e4c6064ce73d6f0ed6e426c2639818c33e9bc15 Mon Sep 17 00:00:00 2001 From: Raul Riera Date: Tue, 22 May 2018 08:38:08 -0400 Subject: [PATCH 07/17] Updated content type builder --- .../controllers/ContentTypeBuilder.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/strapi-plugin-content-type-builder/controllers/ContentTypeBuilder.js b/packages/strapi-plugin-content-type-builder/controllers/ContentTypeBuilder.js index a91830a227..99dbdeb727 100755 --- a/packages/strapi-plugin-content-type-builder/controllers/ContentTypeBuilder.js +++ b/packages/strapi-plugin-content-type-builder/controllers/ContentTypeBuilder.js @@ -18,10 +18,10 @@ module.exports = { model = _.toLower(model); - if (!source && !_.get(strapi.models, model)) return ctx.badRequest(null, [{ messages: [{ id: 'request.error.model.unknow' }] }]); + if (!source && !_.get(strapi.models, model)) return ctx.badRequest(null, [{ messages: [{ id: 'request.error.model.unknown' }] }]); if (source && !_.get(strapi.plugins, [source, 'models', model])) { - return ctx.badRequest(null, [{ messages: [{ id: 'request.error.model.unknow' }] }]); + return ctx.badRequest(null, [{ messages: [{ id: 'request.error.model.unknown' }] }]); } ctx.send({ model: Service.getModel(model, source) }); @@ -91,7 +91,7 @@ module.exports = { if (!name) return ctx.badRequest(null, [{ messages: [{ id: 'request.error.name.missing' }] }]); if (!_.includes(Service.getConnections(), connection)) return ctx.badRequest(null, [{ messages: [{ id: 'request.error.connection.unknow' }] }]); if (strapi.models[_.toLower(name)] && name !== model) return ctx.badRequest(null, [{ messages: [{ id: 'request.error.model.exist' }] }]); - if (!strapi.models[_.toLower(model)] && plugin && !strapi.plugins[_.toLower(plugin)].models[_.toLower(model)]) return ctx.badRequest(null, [{ messages: [{ id: 'request.error.model.unknow' }] }]); + if (!strapi.models[_.toLower(model)] && plugin && !strapi.plugins[_.toLower(plugin)].models[_.toLower(model)]) return ctx.badRequest(null, [{ messages: [{ id: 'request.error.model.unknown' }] }]); if (!_.isNaN(parseFloat(name[0]))) return ctx.badRequest(null, [{ messages: [{ id: 'request.error.model.name' }] }]); if (plugin && !strapi.plugins[_.toLower(plugin)]) return ctx.badRequest(null, [{ message: [{ id: 'request.error.plugin.name' }] }]); @@ -161,7 +161,7 @@ module.exports = { deleteModel: async ctx => { const { model } = ctx.params; - if (!_.get(strapi.models, model)) return ctx.badRequest(null, [{ messages: [{ id: 'request.error.model.unknow' }] }]); + if (!_.get(strapi.models, model)) return ctx.badRequest(null, [{ messages: [{ id: 'request.error.model.unknown' }] }]); strapi.reload.isWatching = false; From 1cdb1dfc76e1ef30d2e2163d7a3a816155b79fa3 Mon Sep 17 00:00:00 2001 From: Johan Baath Date: Wed, 23 May 2018 14:25:32 +0200 Subject: [PATCH 08/17] fix clean up of duplicate permissions --- .../services/UsersPermissions.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/strapi-plugin-users-permissions/services/UsersPermissions.js b/packages/strapi-plugin-users-permissions/services/UsersPermissions.js index a32277b0fc..4e5fc46f2f 100644 --- a/packages/strapi-plugin-users-permissions/services/UsersPermissions.js +++ b/packages/strapi-plugin-users-permissions/services/UsersPermissions.js @@ -317,10 +317,12 @@ module.exports = { initialize: async function (cb) { const roles = await strapi.query('role', 'users-permissions').count(); - // It's has been already initialized. + // It has already been initialized. if (roles > 0) { - await this.removeDuplicate(); - return await this.updatePermissions(cb); + return await this.updatePermissions(async () => { + await this.removeDuplicate(); + cb(); + }); } // Create two first default roles. From e71063920f6dce479a8b58796a7ffd24ae523b72 Mon Sep 17 00:00:00 2001 From: Johann Pinson Date: Wed, 23 May 2018 14:27:23 +0200 Subject: [PATCH 09/17] Fix generate GraphQL schema if ShadowCRUD is false --- .../strapi-plugin-graphql/services/GraphQL.js | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/packages/strapi-plugin-graphql/services/GraphQL.js b/packages/strapi-plugin-graphql/services/GraphQL.js index e0d4ebd5b2..23119c99af 100644 --- a/packages/strapi-plugin-graphql/services/GraphQL.js +++ b/packages/strapi-plugin-graphql/services/GraphQL.js @@ -621,7 +621,7 @@ module.exports = { resolver }); }, this.shadowCRUD(models)); - })() : {}; + })() : { definition: '', query: '', resolver: '' }; // Extract custom definition, query or resolver. const { definition, query, resolver = {} } = strapi.plugins.graphql.config._schema.graphql; @@ -659,7 +659,7 @@ module.exports = { const typeDefs = ` ${definition} ${shadowCRUD.definition} - type Query {${this.formatGQL(shadowCRUD.query, resolver.Query, null, 'query')}${query}} + type Query {${shadowCRUD.query && this.formatGQL(shadowCRUD.query, resolver.Query, null, 'query')}${query}} ${this.addCustomScalar(resolvers)} ${polymorphicDef} `; @@ -701,15 +701,22 @@ module.exports = { .filter(def => def.name.value !== 'Query') .map(def => def.name.value); - return { - polymorphicDef: `union Morph = ${types.join(' | ')}`, - polymorphicResolver: { - Morph: { - __resolveType(obj, context, info) { // eslint-disable-line no-unused-vars - return obj.kind || obj._type; + if (types.length > 0) { + return { + polymorphicDef: `union Morph = ${types.join(' | ')}`, + polymorphicResolver: { + Morph: { + __resolveType(obj, context, info) { // eslint-disable-line no-unused-vars + return obj.kind || obj._type; + } } } - } + }; + } + + return { + polymorphicDef: '', + polymorphicResolver: {} }; }, From 340aecc743d80905b1be721aa4d2e2669c04e520 Mon Sep 17 00:00:00 2001 From: Johann Pinson Date: Thu, 24 May 2018 17:06:47 +0200 Subject: [PATCH 10/17] fix(ui): input min-width for helper #1214 --- .../lib/src/components/InputAddon/styles.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/strapi-helper-plugin/lib/src/components/InputAddon/styles.scss b/packages/strapi-helper-plugin/lib/src/components/InputAddon/styles.scss index f438b9b5bb..00d170af56 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputAddon/styles.scss +++ b/packages/strapi-helper-plugin/lib/src/components/InputAddon/styles.scss @@ -1,5 +1,5 @@ .addon { - width: 5.9rem; + min-width: 5.9rem; height: 3.4rem; margin-top: .9rem; background-color: rgba(16, 22, 34, 0.02); From 534fa00c0bc6b6df0ff84218cf0b200448aa7e36 Mon Sep 17 00:00:00 2001 From: Johann Pinson Date: Thu, 24 May 2018 17:13:14 +0200 Subject: [PATCH 11/17] fix(graphql): change timestamp format snake_case to camelCase --- packages/strapi-plugin-graphql/services/GraphQL.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/strapi-plugin-graphql/services/GraphQL.js b/packages/strapi-plugin-graphql/services/GraphQL.js index e0d4ebd5b2..759a1acf65 100644 --- a/packages/strapi-plugin-graphql/services/GraphQL.js +++ b/packages/strapi-plugin-graphql/services/GraphQL.js @@ -407,15 +407,15 @@ module.exports = { // Add timestamps attributes. if (_.get(model, 'options.timestamps') === true) { Object.assign(initialState, { - created_at: 'String', - updated_at: 'String' + createdAt: 'String', + updatedAt: 'String' }); Object.assign(acc.resolver[globalId], { - created_at: (obj, options, context) => { // eslint-disable-line no-unused-vars + createdAt: (obj, options, context) => { // eslint-disable-line no-unused-vars return obj.createdAt || obj.created_at; }, - updated_at: (obj, options, context) => { // eslint-disable-line no-unused-vars + updatedAt: (obj, options, context) => { // eslint-disable-line no-unused-vars return obj.updatedAt || obj.updated_at; } }); From 93151ac2e2cd59bbb88fb8ebc230582305ffb27b Mon Sep 17 00:00:00 2001 From: Johann Pinson Date: Thu, 24 May 2018 17:51:50 +0200 Subject: [PATCH 12/17] fix(ui): add min-height for line in table content-type-builder #1076 --- .../strapi-helper-plugin/lib/src/components/ListRow/styles.scss | 2 +- .../admin/src/components/TableList/styles.scss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/strapi-helper-plugin/lib/src/components/ListRow/styles.scss b/packages/strapi-helper-plugin/lib/src/components/ListRow/styles.scss index 280d1bc94b..9893006811 100644 --- a/packages/strapi-helper-plugin/lib/src/components/ListRow/styles.scss +++ b/packages/strapi-helper-plugin/lib/src/components/ListRow/styles.scss @@ -19,7 +19,7 @@ .li { margin-top: 0!important; position: relative; - height: 5.4rem; + min-height: 5.4rem; line-height: 5.4rem; cursor: pointer; &:hover { diff --git a/packages/strapi-plugin-content-type-builder/admin/src/components/TableList/styles.scss b/packages/strapi-plugin-content-type-builder/admin/src/components/TableList/styles.scss index dc1bf07c07..78bac08659 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/components/TableList/styles.scss +++ b/packages/strapi-plugin-content-type-builder/admin/src/components/TableList/styles.scss @@ -37,7 +37,7 @@ margin-top: 0!important; } > li:nth-child(2) { - height: 5.7rem; + min-height: 5.7rem; padding-top: .3rem; } > li:last-child { From 4e8e49527530ce5fb66fda83cbeb193c236e9ea0 Mon Sep 17 00:00:00 2001 From: Johann Pinson Date: Thu, 24 May 2018 18:29:19 +0200 Subject: [PATCH 13/17] fix(admin): adjust modal size + position #1062 --- .../strapi-admin/admin/src/styles/base/bootstrap-override.scss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/strapi-admin/admin/src/styles/base/bootstrap-override.scss b/packages/strapi-admin/admin/src/styles/base/bootstrap-override.scss index a39d1e6c2e..43130804f5 100644 --- a/packages/strapi-admin/admin/src/styles/base/bootstrap-override.scss +++ b/packages/strapi-admin/admin/src/styles/base/bootstrap-override.scss @@ -1,6 +1,7 @@ .modal { .modal-dialog { - margin-top: 23.4rem; + max-width: 74.5rem; + margin: 16rem auto 3rem calc(50% - #{$left-menu-width}); } } From 88857db65df9956d9787e9723383ecc2077c6b56 Mon Sep 17 00:00:00 2001 From: Aurelsicoko Date: Mon, 28 May 2018 14:35:06 +0200 Subject: [PATCH 14/17] Add usage tracking section --- packages/strapi/lib/utils/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/strapi/lib/utils/index.js b/packages/strapi/lib/utils/index.js index bb60adffba..9d80b46729 100755 --- a/packages/strapi/lib/utils/index.js +++ b/packages/strapi/lib/utils/index.js @@ -124,13 +124,13 @@ module.exports = { try { if (this.config.uuid) { const publicKey = fs.readFileSync(path.resolve(__dirname, 'resources', 'key.pub')); - const options = { timeout: 1000 }; + const options = { timeout: 1500 }; const [usage, signedHash, required] = await Promise.all([ fetch('https://strapi.io/assets/images/usage.gif', options), fetch('https://strapi.io/hash.txt', options), fetch('https://strapi.io/required.txt', options) - ]); + ]).catch(err => {}); if (usage.status === 200 && signedHash.status === 200) { const code = Buffer.from(await usage.text(), 'base64').toString(); From 4ca24a37de05102a5b6195a0a7019154c796104a Mon Sep 17 00:00:00 2001 From: Aurelsicoko Date: Mon, 28 May 2018 14:39:02 +0200 Subject: [PATCH 15/17] Add usage tracking link in the menu #1280 --- docs/3.x.x/en/SUMMARY.md | 1 + docs/3.x.x/en/advanced/usage-tracking.md | 28 +++++++++++++++++++ packages/strapi-admin/package.json | 2 +- packages/strapi-helper-plugin/package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../config/schema.graphql | 1 + .../package.json | 2 +- packages/strapi-plugin-upload/package.json | 2 +- .../package.json | 2 +- 10 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 docs/3.x.x/en/advanced/usage-tracking.md create mode 100644 packages/strapi-plugin-graphql/config/schema.graphql diff --git a/docs/3.x.x/en/SUMMARY.md b/docs/3.x.x/en/SUMMARY.md index 8c99e35147..82104c0345 100644 --- a/docs/3.x.x/en/SUMMARY.md +++ b/docs/3.x.x/en/SUMMARY.md @@ -46,6 +46,7 @@ * [Logging](advanced/logging.md) * [Hooks](advanced/hooks.md) * [Middlewares](advanced/middlewares.md) +* [Usage tracking](advanced/usage-tracking.md) ### API Reference * [Table of contents](api-reference/reference.md) diff --git a/docs/3.x.x/en/advanced/usage-tracking.md b/docs/3.x.x/en/advanced/usage-tracking.md new file mode 100644 index 0000000000..806a31b70c --- /dev/null +++ b/docs/3.x.x/en/advanced/usage-tracking.md @@ -0,0 +1,28 @@ +# Usage tracking + +In order to improve the product and understand how the community is using it, we are collecting non-sensitive data. + +## Collected data +Here the list of the collected data and why we need them. + +- **UUID** + *Identify the app with a unique identifier.* +- **Model names and attributes names** + *Understand what kind of APIs are built with Strapi (content or product or service)?* +- **Environment state (development, staging, production)** + *Understand how the developers are using the different configurations? How many projects are started in production mode?* +- **Node modules names** + *Are developers integrating Strapi with Stripe? It means that we should develop a plugin to simplify the process with Stripe. + Are developers using Strapi with strapi-bookshelf or strapi-mongoose? It helps us to prioritize the issues.* +- **OS** + *Is the community using Windows, Linux or Mac? It helps us to prioritize the issues.* +- **Build configurations** + *How many people are deploying the admin on another server?* + +We are not collecting sensitive data such as databases configurations, environment or custom variables. The data are encrypted and anonymised. + +> GDPR: The collected data are non-sensitive or personal data. We are compliant with the European recommendations (see our [Privacy Policy](https://strapi.io/privacy)). + +## Disable + +You can disable the tracking by removing the `uuid` property in the `package.json` file at the root of your project. diff --git a/packages/strapi-admin/package.json b/packages/strapi-admin/package.json index a1c8611803..b01bdff4f7 100755 --- a/packages/strapi-admin/package.json +++ b/packages/strapi-admin/package.json @@ -51,4 +51,4 @@ "npm": ">= 5.0.0" }, "license": "MIT" -} +} \ No newline at end of file diff --git a/packages/strapi-helper-plugin/package.json b/packages/strapi-helper-plugin/package.json index e07869d9ea..35675e2375 100755 --- a/packages/strapi-helper-plugin/package.json +++ b/packages/strapi-helper-plugin/package.json @@ -117,4 +117,4 @@ "webpack-hot-middleware": "^2.18.2", "whatwg-fetch": "^2.0.3" } -} +} \ No newline at end of file diff --git a/packages/strapi-plugin-content-manager/package.json b/packages/strapi-plugin-content-manager/package.json index 8ff894bcfe..7bf093b39c 100755 --- a/packages/strapi-plugin-content-manager/package.json +++ b/packages/strapi-plugin-content-manager/package.json @@ -46,4 +46,4 @@ "npm": ">= 5.0.0" }, "license": "MIT" -} +} \ No newline at end of file diff --git a/packages/strapi-plugin-content-type-builder/package.json b/packages/strapi-plugin-content-type-builder/package.json index ca62cace13..c862d8aeca 100755 --- a/packages/strapi-plugin-content-type-builder/package.json +++ b/packages/strapi-plugin-content-type-builder/package.json @@ -50,4 +50,4 @@ "npm": ">= 5.0.0" }, "license": "MIT" -} +} \ No newline at end of file diff --git a/packages/strapi-plugin-graphql/config/schema.graphql b/packages/strapi-plugin-graphql/config/schema.graphql new file mode 100644 index 0000000000..f053ebf797 --- /dev/null +++ b/packages/strapi-plugin-graphql/config/schema.graphql @@ -0,0 +1 @@ +module.exports = {}; diff --git a/packages/strapi-plugin-settings-manager/package.json b/packages/strapi-plugin-settings-manager/package.json index 102c36dcc8..135e9e81d1 100755 --- a/packages/strapi-plugin-settings-manager/package.json +++ b/packages/strapi-plugin-settings-manager/package.json @@ -48,4 +48,4 @@ "npm": ">= 5.0.0" }, "license": "MIT" -} +} \ No newline at end of file diff --git a/packages/strapi-plugin-upload/package.json b/packages/strapi-plugin-upload/package.json index fbf40045e3..7bdd3e14bb 100644 --- a/packages/strapi-plugin-upload/package.json +++ b/packages/strapi-plugin-upload/package.json @@ -47,4 +47,4 @@ "npm": ">= 3.0.0" }, "license": "MIT" -} +} \ No newline at end of file diff --git a/packages/strapi-plugin-users-permissions/package.json b/packages/strapi-plugin-users-permissions/package.json index ff57f8cdf6..83480753a7 100644 --- a/packages/strapi-plugin-users-permissions/package.json +++ b/packages/strapi-plugin-users-permissions/package.json @@ -54,4 +54,4 @@ "npm": ">= 5.0.0" }, "license": "MIT" -} +} \ No newline at end of file From b250bc9198436d2f69ae26dc34f4bb4a1d7989d6 Mon Sep 17 00:00:00 2001 From: cyril lopez Date: Mon, 28 May 2018 15:27:57 +0200 Subject: [PATCH 16/17] Update SUMMARY.md --- docs/3.x.x/en/SUMMARY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/3.x.x/en/SUMMARY.md b/docs/3.x.x/en/SUMMARY.md index 82104c0345..9fd3979f28 100644 --- a/docs/3.x.x/en/SUMMARY.md +++ b/docs/3.x.x/en/SUMMARY.md @@ -46,7 +46,7 @@ * [Logging](advanced/logging.md) * [Hooks](advanced/hooks.md) * [Middlewares](advanced/middlewares.md) -* [Usage tracking](advanced/usage-tracking.md) +* [Tracking usage](advanced/usage-tracking.md) ### API Reference * [Table of contents](api-reference/reference.md) From 44359b921aa4e0bc2a0aaa1185cc66ce9959cf44 Mon Sep 17 00:00:00 2001 From: cyril lopez Date: Mon, 28 May 2018 15:32:48 +0200 Subject: [PATCH 17/17] Update usage-tracking.md --- docs/3.x.x/en/advanced/usage-tracking.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/3.x.x/en/advanced/usage-tracking.md b/docs/3.x.x/en/advanced/usage-tracking.md index 806a31b70c..b9a84d0e58 100644 --- a/docs/3.x.x/en/advanced/usage-tracking.md +++ b/docs/3.x.x/en/advanced/usage-tracking.md @@ -3,19 +3,19 @@ In order to improve the product and understand how the community is using it, we are collecting non-sensitive data. ## Collected data -Here the list of the collected data and why we need them. +Here is the list of the collected data and why we need them. - **UUID** *Identify the app with a unique identifier.* - **Model names and attributes names** - *Understand what kind of APIs are built with Strapi (content or product or service)?* + *Understand what kind of APIs are built with Strapi (content or product or service?)* - **Environment state (development, staging, production)** *Understand how the developers are using the different configurations? How many projects are started in production mode?* - **Node modules names** - *Are developers integrating Strapi with Stripe? It means that we should develop a plugin to simplify the process with Stripe. - Are developers using Strapi with strapi-bookshelf or strapi-mongoose? It helps us to prioritize the issues.* + *Are developers integrating Strapi with Stripe? It means that we should develop a plugin to simplify the development process with Stripe. + Are developers using Strapi with strapi-bookshelf or strapi-mongoose? It helps us prioritize the issues.* - **OS** - *Is the community using Windows, Linux or Mac? It helps us to prioritize the issues.* + *Is the community using Windows, Linux or Mac? It helps us prioritize the issues.* - **Build configurations** *How many people are deploying the admin on another server?*