Merge branch 'master' into patch-3

This commit is contained in:
Jim LAURIE 2018-05-24 18:58:26 +02:00 committed by GitHub
commit 93eb13e7dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 15 deletions

View File

@ -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.name.value !== 'Query')
.filter(def => def.kind === 'ObjectTypeDefinition' && def.name.value !== 'Query')
.map(def => def.name.value);
if (types.length > 0) {

View File

@ -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.