mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 03:12:54 +03:00
Merge pull request #4614 from ErisDS/issue-4612
Sitemaps correctly filter draft posts
This commit is contained in:
commit
251d2e0ecf
@ -118,6 +118,10 @@ _.extend(SiteMapManager.prototype, {
|
||||
return;
|
||||
}
|
||||
|
||||
if (post.get('status') !== 'published') {
|
||||
return;
|
||||
}
|
||||
|
||||
this.posts.addUrl(post.toJSON());
|
||||
},
|
||||
|
||||
|
@ -157,6 +157,25 @@ describe('Sitemap', function () {
|
||||
}).catch(done);
|
||||
});
|
||||
|
||||
it('doesn\'t add draft pages', function (done) {
|
||||
var manager = makeStubManager(),
|
||||
fake = {
|
||||
toJSON: sandbox.stub().returns({
|
||||
status: 'draft'
|
||||
}),
|
||||
get: sandbox.stub().returns('draft'),
|
||||
updated: sandbox.stub().returns('draft')
|
||||
};
|
||||
|
||||
manager.init().then(function () {
|
||||
manager.pageAdded(fake);
|
||||
|
||||
manager.pages.addUrl.called.should.equal(false);
|
||||
|
||||
done();
|
||||
}).catch(done);
|
||||
});
|
||||
|
||||
it('deletes pages that were unpublished', function (done) {
|
||||
var manager = makeStubManager(),
|
||||
fake = {
|
||||
@ -225,6 +244,24 @@ describe('Sitemap', function () {
|
||||
}).catch(done);
|
||||
});
|
||||
|
||||
it('doesn\'t add draft posts', function (done) {
|
||||
var manager = makeStubManager(),
|
||||
fake = {
|
||||
toJSON: sandbox.stub().returns({
|
||||
status: 'draft'
|
||||
}),
|
||||
get: sandbox.stub().returns('draft'),
|
||||
updated: sandbox.stub().returns('draft')
|
||||
};
|
||||
|
||||
manager.init().then(function () {
|
||||
manager.postAdded(fake);
|
||||
manager.posts.addUrl.called.should.equal(false);
|
||||
|
||||
done();
|
||||
}).catch(done);
|
||||
});
|
||||
|
||||
it('deletes posts that were unpublished', function (done) {
|
||||
var manager = makeStubManager(),
|
||||
fake = {
|
||||
|
Loading…
Reference in New Issue
Block a user