mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Merge pull request #6988 from kirrg001/improvement/forward-utc-timestamp-for-scheduler
post-scheduling: forward UTC timestamp to scheduler adapters
This commit is contained in:
commit
fe5e0eed48
3 changed files with 6 additions and 6 deletions
|
@ -13,11 +13,11 @@ _private.normalize = function normalize(options) {
|
||||||
client = options.client;
|
client = options.client;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
time: object.get('published_at'),
|
time: moment(object.get('published_at')).valueOf(),
|
||||||
url: apiUrl + '/schedules/posts/' + object.get('id') + '?client_id=' + client.get('slug') + '&client_secret=' + client.get('secret'),
|
url: apiUrl + '/schedules/posts/' + object.get('id') + '?client_id=' + client.get('slug') + '&client_secret=' + client.get('secret'),
|
||||||
extra: {
|
extra: {
|
||||||
httpMethod: 'PUT',
|
httpMethod: 'PUT',
|
||||||
oldTime: object.updated('published_at') || null
|
oldTime: object.updated('published_at') ? moment(object.updated('published_at')).valueOf() : null
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -231,10 +231,9 @@ describe('Schedules API', function () {
|
||||||
slug: 'fourth'
|
slug: 'fourth'
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Promise.all(scope.posts.map(function (post) {
|
Promise.mapSeries(scope.posts, function (post) {
|
||||||
return models.Post.add(post, {context: {internal: true}});
|
return models.Post.add(post, {context: {internal: true}});
|
||||||
})).then(function (result) {
|
}).then(function (result) {
|
||||||
// returns id 1 and 2, but hard to check, because PG returns a different order
|
|
||||||
result.length.should.eql(4);
|
result.length.should.eql(4);
|
||||||
return done();
|
return done();
|
||||||
}).catch(done);
|
}).catch(done);
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
var should = require('should'),
|
var should = require('should'),
|
||||||
sinon = require('sinon'),
|
sinon = require('sinon'),
|
||||||
Promise = require('bluebird'),
|
Promise = require('bluebird'),
|
||||||
|
moment = require('moment'),
|
||||||
config = require(__dirname + '/../../../../server/config'),
|
config = require(__dirname + '/../../../../server/config'),
|
||||||
testUtils = require(config.paths.corePath + '/test/utils'),
|
testUtils = require(config.paths.corePath + '/test/utils'),
|
||||||
errors = require(config.paths.corePath + '/server/errors'),
|
errors = require(config.paths.corePath + '/server/errors'),
|
||||||
|
@ -70,7 +71,7 @@ describe('Scheduling: Post Scheduling', function () {
|
||||||
scope.adapter.schedule.called.should.eql(true);
|
scope.adapter.schedule.called.should.eql(true);
|
||||||
|
|
||||||
scope.adapter.schedule.calledWith({
|
scope.adapter.schedule.calledWith({
|
||||||
time: scope.post.get('published_at'),
|
time: moment(scope.post.get('published_at')).valueOf(),
|
||||||
url: scope.apiUrl + '/schedules/posts/' + scope.post.get('id') + '?client_id=' + scope.client.get('slug') + '&client_secret=' + scope.client.get('secret'),
|
url: scope.apiUrl + '/schedules/posts/' + scope.post.get('id') + '?client_id=' + scope.client.get('slug') + '&client_secret=' + scope.client.get('secret'),
|
||||||
extra: {
|
extra: {
|
||||||
httpMethod: 'PUT',
|
httpMethod: 'PUT',
|
||||||
|
|
Loading…
Add table
Reference in a new issue