-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated method getApiPath
to take options as param
#9937
Conversation
556e2e9
to
94afca1
Compare
@rishabhgrg Can you pls rebase and update? Thanks :) |
3c07703
to
28fdf6f
Compare
27dd433
to
0a3e7b3
Compare
core/server/services/url/utils.js
Outdated
@@ -324,7 +327,8 @@ function urlFor(context, data, absolute) { | |||
} | |||
|
|||
if (data && data.version) { | |||
apiPath = getApiPath(data.version, data.admin); | |||
let versionType = data.admin ? 'admin' : 'content'; |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
6042689
to
a99a393
Compare
core/server/api/v0.1/index.js
Outdated
@@ -115,7 +115,7 @@ const cacheInvalidationHeader = (req, result) => { | |||
* @return {String} Resolves to header string | |||
*/ | |||
const locationHeader = (req, result) => { | |||
const apiRoot = urlService.utils.urlFor('api', {version: 'deprecated'}); | |||
const apiRoot = urlService.utils.urlFor('api', {version: 'deprecated', versionType: 'content'}); |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
2531dc4
to
8cf6127
Compare
parentApp.use(urlUtils.getApiPath('deprecated'), require('./api/v0.1/app')()); | ||
parentApp.use(urlUtils.getApiPath('active'), require('./api/v2/content/app')()); | ||
parentApp.use(urlUtils.getApiPath('active', true), require('./api/v2/admin/app')()); | ||
parentApp.use(urlUtils.getApiPath({version: 'deprecated'}), require('./api/v0.1/app')()); |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@@ -44,7 +44,7 @@ function initialiseServices() { | |||
scheduling.init({ | |||
schedulerUrl: config.get('scheduling').schedulerUrl, | |||
active: config.get('scheduling').active, | |||
apiUrl: urlService.utils.urlFor('api', {version: 'deprecated'}, true), | |||
apiUrl: urlService.utils.urlFor('api', {version: 'deprecated', versionType: 'content'}, true), |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Refs TryGhost#9936 - Updated method to take single options param with version and admin instead of separate values - Updated urlFor method to use the updated syntax - Updated parent-app to use updated syntax
no issue - Updated urlFor to work with versionType instead of admin:true - Updated tests to use the correct method call
8cf6127
to
154d4c3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to self merge 👍
We will improve some of the external url generation places next week. It's not perfect yet and we know that, but we delay the optimisation to next week
Refs #9936
version
andtype
instead of separate values