Removed bluebird from core/server/api/endpoints

refs https://github.com/TryGhost/Ghost/issues/14882
This commit is contained in:
Halldor Thorhallsson 2022-11-01 09:07:17 -05:00 committed by Daniel Lockyer
parent 2edde38575
commit 49f6477ad5
19 changed files with 18 additions and 34 deletions

View File

@ -1,4 +1,3 @@
const Promise = require('bluebird');
const api = require('./index');
const config = require('../../../shared/config');
const tpl = require('@tryghost/tpl');

View File

@ -1,4 +1,3 @@
const Promise = require('bluebird');
const tpl = require('@tryghost/tpl');
const errors = require('@tryghost/errors');
const {mapQuery} = require('@tryghost/mongo-utils');

View File

@ -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({

View File

@ -1,4 +1,3 @@
const Promise = require('bluebird');
const tpl = require('@tryghost/tpl');
const errors = require('@tryghost/errors');
const invites = require('../../services/invites');

View File

@ -1,4 +1,3 @@
const Promise = require('bluebird');
const tpl = require('@tryghost/tpl');
const errors = require('@tryghost/errors');
const models = require('../../models');

View File

@ -1,4 +1,3 @@
const Promise = require('bluebird');
const tpl = require('@tryghost/tpl');
const mailService = require('../../services/mail');
const api = require('./');

View File

@ -1,4 +1,3 @@
const Promise = require('bluebird');
const tpl = require('@tryghost/tpl');
const errors = require('@tryghost/errors');
const models = require('../../models');

View File

@ -1,4 +1,3 @@
const Promise = require('bluebird');
const errors = require('@tryghost/errors');
const tpl = require('@tryghost/tpl');
const models = require('../../models');

View File

@ -1,4 +1,3 @@
const Promise = require('bluebird');
const tpl = require('@tryghost/tpl');
const errors = require('@tryghost/errors');
const models = require('../../models');

View File

@ -1,4 +1,3 @@
const Promise = require('bluebird');
const tpl = require('@tryghost/tpl');
const errors = require('@tryghost/errors');
const models = require('../../models');

View File

@ -1,4 +1,3 @@
const Promise = require('bluebird');
const tpl = require('@tryghost/tpl');
const errors = require('@tryghost/errors');
const models = require('../../models');

View File

@ -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');

View File

@ -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,17 +12,19 @@ module.exports = {
roles: roles
};
} else {
return Promise.filter(roles.map((role) => {
return canThis(frame.options.context).assign.role(role)
.return(role)
.catch(() => {});
}), (value) => {
return value && (value.name !== 'Owner');
}).then((filteredRoles) => {
return frame.response = {
roles: filteredRoles
};
});
return Promise.all(
roles.map(async (role) => {
const permissionResult = await canThis(frame.options.context).assign.role(role)
.return(role)
.catch(() => {});
return permissionResult && (permissionResult.name !== 'Owner');
}))
.then(results => roles.filter((_v, index) => results[index]))
.then((filteredRoles) => {
return frame.response = {
roles: filteredRoles
};
});
}
}
};

View File

@ -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');

View File

@ -1,4 +1,3 @@
const Promise = require('bluebird');
const tpl = require('@tryghost/tpl');
const errors = require('@tryghost/errors');
const models = require('../../../../../models');

View File

@ -1,4 +1,3 @@
const Promise = require('bluebird');
const tpl = require('@tryghost/tpl');
const errors = require('@tryghost/errors');

View File

@ -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');

View File

@ -1,4 +1,3 @@
const Promise = require('bluebird');
const _ = require('lodash');
const {ValidationError} = require('@tryghost/errors');
const validator = require('@tryghost/validator');

View File

@ -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');