Merge pull request #5863 from acburdine/author-edit

Add `/author/:slug/edit/` route to frontend
This commit is contained in:
Hannah Wolfe 2015-09-24 08:42:55 +01:00
commit 07e18cbdff
2 changed files with 29 additions and 0 deletions

View File

@ -66,6 +66,9 @@ frontendRoutes = function frontendRoutes(middleware) {
// Authors // Authors
authorRouter.route('/').get(frontend.author); authorRouter.route('/').get(frontend.author);
authorRouter.route('/edit?').get(function redirect(req, res) {
res.redirect(subdir + '/ghost/team/' + req.params.slug + '/');
});
authorRouter.route('/' + routeKeywords.page + '/:page/').get(frontend.author); authorRouter.route('/' + routeKeywords.page + '/:page/').get(frontend.author);
authorRouter.use(rssRouter); authorRouter.use(rssRouter);

View File

@ -583,6 +583,32 @@ describe('Frontend Routing', function () {
.end(doEnd(done)); .end(doEnd(done));
}); });
}); });
describe('Author edit', function () {
it('should redirect without slash', function (done) {
request.get('/author/ghost-owner/edit')
.expect('Location', '/author/ghost-owner/edit/')
.expect('Cache-Control', testUtils.cacheRules.year)
.expect(301)
.end(doEnd(done));
});
it('should redirect to editor', function (done) {
request.get('/author/ghost-owner/edit/')
.expect('Location', '/ghost/team/ghost-owner/')
.expect('Cache-Control', testUtils.cacheRules['public'])
.expect(302)
.end(doEnd(done));
});
it('should 404 for something that isn\'t edit', function (done) {
request.get('/author/ghost-owner/notedit/')
.expect('Cache-Control', testUtils.cacheRules['private'])
.expect(404)
.expect(/Page not found/)
.end(doEnd(done));
});
});
}); });
describe('Tag pages', function () { describe('Tag pages', function () {