1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00

Removed use of ?include=tags,authors,authors.roles query param on post/page requests

no issue
- Admin API v2 now includes tags and authors by default
This commit is contained in:
Kevin Ansfield 2019-02-25 21:55:55 +07:00
parent b34269b66c
commit 3cf7912ab0
6 changed files with 31 additions and 12 deletions

12
app/adapters/page.js Normal file
View file

@ -0,0 +1,12 @@
import ApplicationAdapter from 'ghost-admin/adapters/application';
export default ApplicationAdapter.extend({
// posts and pages now include everything by default
buildIncludeURL(store, modelName, id, snapshot, requestType, query) {
return this.buildURL(modelName, id, snapshot, requestType, query);
},
buildQuery(store, modelName, options) {
return options;
}
});

12
app/adapters/post.js Normal file
View file

@ -0,0 +1,12 @@
import ApplicationAdapter from 'ghost-admin/adapters/application';
export default ApplicationAdapter.extend({
// posts and pages now include everything by default
buildIncludeURL(store, modelName, id, snapshot, requestType, query) {
return this.buildURL(modelName, id, snapshot, requestType, query);
},
buildQuery(store, modelName, options) {
return options;
}
});

View file

@ -17,8 +17,7 @@ export default AuthenticatedRoute.extend({
model(params) {
let query = {
id: params.post_id,
status: 'all',
formats: 'mobiledoc,plaintext'
status: 'all'
};
return this.store.query(params.type, query)

View file

@ -67,8 +67,6 @@ export default AuthenticatedRoute.extend({
queryParams.order = params.order;
}
queryParams.formats = 'mobiledoc,plaintext';
let perPage = this.perPage;
let paginationSettings = assign({perPage, startingPage: 1}, paginationParams, queryParams);

View file

@ -0,0 +1,3 @@
import PostSerializer from './post';
export default PostSerializer.extend({});

View file

@ -3,16 +3,11 @@ import BaseSerializer from './application';
export default BaseSerializer.extend({
embed: true,
include(request) {
include(/*request*/) {
let includes = [];
if (request.queryParams.include && request.queryParams.include.indexOf('tags') >= 0) {
includes.push('tags');
}
if (request.queryParams.include && request.queryParams.include.indexOf('authors') >= 0) {
includes.push('authors');
}
includes.push('tags');
includes.push('authors');
return includes;
}