0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Used correct posts controller name for Content API v2

no issue
This commit is contained in:
kirrg001 2019-02-25 20:40:19 +01:00 committed by Katharina Irrgang
parent 38e93c19b5
commit 5a52336791
2 changed files with 5 additions and 4 deletions

View file

@ -7,10 +7,11 @@ const Promise = require('bluebird');
const config = require('../../../config');
// The default settings for a default post query
// @TODO: get rid of this config and use v0.1 or v2 config
const queryDefaults = {
type: 'browse',
resource: 'posts',
controller: 'posts',
controller: 'postsPublic',
options: {}
};
@ -55,7 +56,7 @@ function processQuery(query, slugParam, locals) {
query.options.context = {member: locals.member};
}
// Return a promise for the api query
return api[query.controller][query.type](query.options);
return (api[query.controller] || api[query.resource])[query.type](query.options);
}
/**

View file

@ -1763,7 +1763,7 @@ describe('Integration - Web - Site', function () {
});
beforeEach(function () {
const postsAPI = require('../../../server/api/v2/posts');
const postsAPI = require('../../../server/api/v2/posts-public');
configUtils.set('url', 'http://example.com');
postSpy = sinon.spy(postsAPI.browse, 'query');
});
@ -3027,7 +3027,7 @@ describe('Integration - Web - Site', function () {
data: {
query: {
post: {
controller: 'posts',
controller: 'postsPublic',
resource: 'posts',
type: 'read',
options: {