mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-18 07:51:55 +03:00
1421c92ba5
refs #6413 - PUT endpoint to publish a post/page for the scheduler - fn endpoint to get all scheduled posts (with from/to query params) for the scheduler - hardcoded permission handling for scheduler client - fix event bug: unscheduled - basic structure for scheduling - post scheduling basics - offer easy option to change adapter - integrate the default scheduler adapter - update scheduled posts when blog TZ changes - safety check before scheduler can publish a post (not allowed to publish in the future or past) - add force flag to allow publishing in the past - invalidate cache header for /schedules/posts/:id
18 lines
441 B
JavaScript
18 lines
441 B
JavaScript
var Promise = require('bluebird');
|
|
|
|
/**
|
|
* expects an array of functions returning a promise
|
|
*/
|
|
function sequence(tasks /* Any Arguments */) {
|
|
var args = Array.prototype.slice.call(arguments, 1);
|
|
|
|
return Promise.reduce(tasks, function (results, task) {
|
|
return task.apply(this, args).then(function (result) {
|
|
results.push(result);
|
|
return results;
|
|
});
|
|
}, []);
|
|
}
|
|
|
|
module.exports = sequence;
|