mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 03:44:29 +03:00
Removed bluebird from core/server/api/endpoints
refs https://github.com/TryGhost/Ghost/issues/14882
This commit is contained in:
parent
2edde38575
commit
49f6477ad5
@ -1,4 +1,3 @@
|
||||
const Promise = require('bluebird');
|
||||
const api = require('./index');
|
||||
const config = require('../../../shared/config');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
|
@ -1,4 +1,3 @@
|
||||
const Promise = require('bluebird');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
const errors = require('@tryghost/errors');
|
||||
const {mapQuery} = require('@tryghost/mongo-utils');
|
||||
|
@ -1,10 +1,10 @@
|
||||
const Promise = require('bluebird');
|
||||
const moment = require('moment-timezone');
|
||||
const dbBackup = require('../../data/db/backup');
|
||||
const exporter = require('../../data/exporter');
|
||||
const importer = require('../../data/importer');
|
||||
const mediaInliner = require('../../services/media-inliner');
|
||||
const errors = require('@tryghost/errors');
|
||||
const {pool} = require('@tryghost/promise');
|
||||
const models = require('../../models');
|
||||
const settingsCache = require('../../../shared/settings-cache');
|
||||
|
||||
@ -151,15 +151,15 @@ module.exports = {
|
||||
|
||||
return models.Post.findAll(queryOpts)
|
||||
.then((response) => {
|
||||
return Promise.map(response.models, (post) => {
|
||||
return pool(response.models.map(post => () => {
|
||||
return models.Post.destroy(Object.assign({id: post.id}, queryOpts));
|
||||
}, {concurrency: 100});
|
||||
}), 100);
|
||||
})
|
||||
.then(() => models.Tag.findAll(queryOpts))
|
||||
.then((response) => {
|
||||
return Promise.map(response.models, (tag) => {
|
||||
return pool(response.models.map(tag => () => {
|
||||
return models.Tag.destroy(Object.assign({id: tag.id}, queryOpts));
|
||||
}, {concurrency: 100});
|
||||
}), 100);
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new errors.InternalServerError({
|
||||
|
@ -1,4 +1,3 @@
|
||||
const Promise = require('bluebird');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
const errors = require('@tryghost/errors');
|
||||
const invites = require('../../services/invites');
|
||||
|
@ -1,4 +1,3 @@
|
||||
const Promise = require('bluebird');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
const errors = require('@tryghost/errors');
|
||||
const models = require('../../models');
|
||||
|
@ -1,4 +1,3 @@
|
||||
const Promise = require('bluebird');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
const mailService = require('../../services/mail');
|
||||
const api = require('./');
|
||||
|
@ -1,4 +1,3 @@
|
||||
const Promise = require('bluebird');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
const errors = require('@tryghost/errors');
|
||||
const models = require('../../models');
|
||||
|
@ -1,4 +1,3 @@
|
||||
const Promise = require('bluebird');
|
||||
const errors = require('@tryghost/errors');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
const models = require('../../models');
|
||||
|
@ -1,4 +1,3 @@
|
||||
const Promise = require('bluebird');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
const errors = require('@tryghost/errors');
|
||||
const models = require('../../models');
|
||||
|
@ -1,4 +1,3 @@
|
||||
const Promise = require('bluebird');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
const errors = require('@tryghost/errors');
|
||||
const models = require('../../models');
|
||||
|
@ -1,4 +1,3 @@
|
||||
const Promise = require('bluebird');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
const errors = require('@tryghost/errors');
|
||||
const models = require('../../models');
|
||||
|
@ -1,5 +1,4 @@
|
||||
const debug = require('@tryghost/debug')('api:endpoints:utils:permissions');
|
||||
const Promise = require('bluebird');
|
||||
const _ = require('lodash');
|
||||
const permissions = require('../../../services/permissions');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
|
@ -1,4 +1,3 @@
|
||||
const Promise = require('bluebird');
|
||||
const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:output:roles');
|
||||
const canThis = require('../../../../../services/permissions').canThis;
|
||||
|
||||
@ -13,13 +12,15 @@ module.exports = {
|
||||
roles: roles
|
||||
};
|
||||
} else {
|
||||
return Promise.filter(roles.map((role) => {
|
||||
return canThis(frame.options.context).assign.role(role)
|
||||
return Promise.all(
|
||||
roles.map(async (role) => {
|
||||
const permissionResult = await canThis(frame.options.context).assign.role(role)
|
||||
.return(role)
|
||||
.catch(() => {});
|
||||
}), (value) => {
|
||||
return value && (value.name !== 'Owner');
|
||||
}).then((filteredRoles) => {
|
||||
return permissionResult && (permissionResult.name !== 'Owner');
|
||||
}))
|
||||
.then(results => roles.filter((_v, index) => results[index]))
|
||||
.then((filteredRoles) => {
|
||||
return frame.response = {
|
||||
roles: filteredRoles
|
||||
};
|
||||
|
@ -1,4 +1,3 @@
|
||||
const Promise = require('bluebird');
|
||||
const validator = require('@tryghost/validator');
|
||||
const debug = require('@tryghost/debug')('api:endpoints:utils:validators:input:invitation');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
|
@ -1,4 +1,3 @@
|
||||
const Promise = require('bluebird');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
const errors = require('@tryghost/errors');
|
||||
const models = require('../../../../../models');
|
||||
|
@ -1,4 +1,3 @@
|
||||
const Promise = require('bluebird');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
const errors = require('@tryghost/errors');
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* eslint-disable ghost/filenames/match-regex */
|
||||
const Promise = require('bluebird');
|
||||
const validator = require('@tryghost/validator');
|
||||
const debug = require('@tryghost/debug')('api:endpoints:utils:validators:input:passwordreset');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
|
@ -1,4 +1,3 @@
|
||||
const Promise = require('bluebird');
|
||||
const _ = require('lodash');
|
||||
const {ValidationError} = require('@tryghost/errors');
|
||||
const validator = require('@tryghost/validator');
|
||||
|
@ -1,4 +1,3 @@
|
||||
const Promise = require('bluebird');
|
||||
const debug = require('@tryghost/debug')('api:endpoints:utils:validators:input:users');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
const errors = require('@tryghost/errors');
|
||||
|
Loading…
Reference in New Issue
Block a user