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'); debug('redirect. is edit url');
const resourceType = entry.page ? 'page' : 'post'; 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'; const resourceType = post.page ? 'page' : 'post';
// CASE: last param of the url is /edit, redirect to admin // 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) { } else if (req.params.options) {
// CASE: unknown options param detected, ignore // CASE: unknown options param detected, ignore
return next(); return next();

View File

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

View File

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

View File

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