diff --git a/docs/3.x.x/en/SUMMARY.md b/docs/3.x.x/en/SUMMARY.md index 8c99e35147..9fd3979f28 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) +* [Tracking usage](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..b9a84d0e58 --- /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 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?)* +- **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 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 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/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}); } } 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": "這個資料不存在" } 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/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); 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-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/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/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/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) ?
: li:nth-child(2) { - height: 5.7rem; + min-height: 5.7rem; padding-top: .3rem; } > li:last-child { diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/index.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/index.js index e249113996..1eaea03009 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/index.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/index.js @@ -395,6 +395,12 @@ export class Form extends React.Component { // eslint-disable-line react/prefer- this.props.changeInputAttribute('params.dominant', true); } + if (target.name === 'params.nature' && target.value === "oneWay") { + this.props.changeInputAttribute('params.key', '-'); + }else if (target.name === 'params.nature'){ + this.props.changeInputAttribute('params.key', ''); + } + } else { this.props.changeInput(target.name, value, includes(this.props.hash, 'edit')); } @@ -533,6 +539,7 @@ export class Form extends React.Component { // eslint-disable-line react/prefer- } render() { + // Ensure typeof(popUpFormType) is String const popUpFormType = split(this.props.hash, '::')[1] || ''; const popUpTitle = this.generatePopUpTitle(popUpFormType); diff --git a/packages/strapi-plugin-content-type-builder/admin/src/translations/en.json b/packages/strapi-plugin-content-type-builder/admin/src/translations/en.json index 1a82424a3a..75e909c4bd 100755 --- a/packages/strapi-plugin-content-type-builder/admin/src/translations/en.json +++ b/packages/strapi-plugin-content-type-builder/admin/src/translations/en.json @@ -169,7 +169,8 @@ "table.contentType.head.description": "Description", "table.contentType.head.fields": "Fields", - "relation.oneToOne": "has one", + "relation.oneWay": "has one", + "relation.oneToOne": "has and belongs to one", "relation.oneToMany": "belongs to many", "relation.manyToOne": "has many", "relation.manyToMany": "has and belongs to many", diff --git a/packages/strapi-plugin-content-type-builder/admin/src/translations/tr.json b/packages/strapi-plugin-content-type-builder/admin/src/translations/tr.json index 9439ccd097..e143902934 100755 --- a/packages/strapi-plugin-content-type-builder/admin/src/translations/tr.json +++ b/packages/strapi-plugin-content-type-builder/admin/src/translations/tr.json @@ -167,6 +167,7 @@ "table.contentType.head.description": "Açıklama", "table.contentType.head.fields": "Alanlar", + "relation.oneWay": "tek yönlü", "relation.oneToOne": "biri var", "relation.oneToMany": "Birçoğuna ait", "relation.manyToOne": "Birçok var", 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; 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-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(); 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-graphql/services/GraphQL.js b/packages/strapi-plugin-graphql/services/GraphQL.js index e0d4ebd5b2..e1b7cda05c 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] = {}; @@ -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; } }); @@ -614,14 +614,14 @@ 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, 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} `; @@ -687,7 +687,7 @@ module.exports = { JSON: GraphQLJSON }); - return `scalar JSON`; + return 'scalar JSON'; }, /** @@ -698,18 +698,25 @@ 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 { - 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: {} }; }, 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 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. 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();