Updated edit URLs to use consistent correct URLs

- Ghost Admin has a redirect system built in, so not using the # does work
- However, the usage of # or no # was inconsistent, which is always wrong
- Using the correct Ghost Admin URLs makes it easier to reason about the behaviour
This commit is contained in:
Hannah Wolfe 2020-05-30 09:40:11 +01:00
parent 9948e85154
commit dd9bf73a0b
6 changed files with 6 additions and 6 deletions

View File

@ -41,7 +41,7 @@ module.exports = function entryController(req, res, next) {
debug('redirect. is edit url');
const resourceType = entry.page ? 'page' : 'post';
return urlUtils.redirectToAdmin(302, res, `/editor/${resourceType}/${entry.id}`);
return urlUtils.redirectToAdmin(302, res, `/#/editor/${resourceType}/${entry.id}`);
}
/**

View File

@ -43,7 +43,7 @@ module.exports = function previewController(req, res, next) {
const resourceType = post.page ? 'page' : 'post';
// CASE: last param of the url is /edit, redirect to admin
return urlUtils.redirectToAdmin(302, res, `/editor/${resourceType}/${post.id}`);
return urlUtils.redirectToAdmin(302, res, `/#/editor/${resourceType}/${post.id}`);
} else if (req.params.options) {
// CASE: unknown options param detected, ignore
return next();

View File

@ -160,7 +160,7 @@ describe('Default Frontend routing', function () {
describe('Post edit', function () {
it('should redirect to editor', function (done) {
request.get('/welcome/edit/')
.expect('Location', /ghost\/editor\/\w+/)
.expect('Location', /ghost\/#\/editor\/\w+/)
.expect('Cache-Control', testUtils.cacheRules.public)
.expect(302)
.end(doEnd(done));

View File

@ -170,7 +170,7 @@ describe('Frontend Routing', function () {
it('should redirect to editor', function (done) {
request.get('/static-page-test/edit/')
.expect('Location', /ghost\/editor\/\w+/)
.expect('Location', /ghost\/#\/editor\/\w+/)
.expect('Cache-Control', testUtils.cacheRules.public)
.expect(302)
.end(doEnd(done));

View File

@ -6,7 +6,7 @@ const urlService = require('../../../../../core/frontend/services/url');
const urlUtils = require('../../../../../core/shared/url-utils');
const controllers = require('../../../../../core/frontend/services/routing/controllers');
const helpers = require('../../../../../core/frontend/services/routing/helpers');
const EDITOR_URL = `/editor/post/`;
const EDITOR_URL = `/#/editor/post/`;
describe('Unit - services/routing/controllers/entry', function () {
let req;

View File

@ -8,7 +8,7 @@ const controllers = require('../../../../../core/frontend/services/routing/contr
const helpers = require('../../../../../core/frontend/services/routing/helpers');
const urlService = require('../../../../../core/frontend/services/url');
const urlUtils = require('../../../../../core/shared/url-utils');
const EDITOR_URL = '/editor/post/';
const EDITOR_URL = '/#/editor/post/';
describe('Unit - services/routing/controllers/preview', function () {
let secureStub;