mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 05:37:34 +03:00
Replaced Promise.map() with .all() in importer (#15616)
refs: https://github.com/TryGhost/Ghost/issues/14882 - Removing bluebird specific methods in favour of the Ghost sequence method so we can remove the bluebird dependency Co-authored-by: Carol-Barno <cbarno@innovexsolutions.co.ke>
This commit is contained in:
parent
7df2b7625f
commit
a24eb06179
@ -1,5 +1,4 @@
|
||||
const _ = require('lodash');
|
||||
const Promise = require('bluebird');
|
||||
const path = require('path');
|
||||
const config = require('../../../../shared/config');
|
||||
const urlUtils = require('../../../../shared/url-utils');
|
||||
@ -35,14 +34,14 @@ ImageHandler = {
|
||||
return file;
|
||||
});
|
||||
|
||||
return Promise.map(files, function (image) {
|
||||
return Promise.all(files.map(function (image) {
|
||||
return store.getUniqueFileName(image, image.targetDir).then(function (targetFilename) {
|
||||
image.newPath = urlUtils.urlJoin('/', urlUtils.getSubdir(), urlUtils.STATIC_IMAGE_URL_PREFIX,
|
||||
path.relative(config.getContentPath('images'), targetFilename));
|
||||
|
||||
return image;
|
||||
});
|
||||
});
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
const _ = require('lodash');
|
||||
const Promise = require('bluebird');
|
||||
const storage = require('../../../adapters/storage');
|
||||
let replaceImage;
|
||||
let ImageImporter;
|
||||
@ -66,11 +65,11 @@ ImageImporter = {
|
||||
doImport: function (imageData) {
|
||||
const store = storage.getStorage('images');
|
||||
|
||||
return Promise.map(imageData, function (image) {
|
||||
return Promise.all(imageData.map(function (image) {
|
||||
return store.save(image, image.targetDir).then(function (result) {
|
||||
return {originalPath: image.originalPath, newPath: image.newPath, stored: result};
|
||||
});
|
||||
});
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user