mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 20:03:12 +03:00
Added computed "excerpt" field to Admin API v2
no issue
This commit is contained in:
parent
e65a82833c
commit
28a222703b
@ -32,9 +32,9 @@ const mapPost = (model, frame) => {
|
||||
if (utils.isContentAPI(frame)) {
|
||||
date.forPost(jsonModel);
|
||||
members.forPost(jsonModel, frame);
|
||||
extraAttrs.forPost(frame, model, jsonModel);
|
||||
}
|
||||
|
||||
extraAttrs.forPost(frame, model, jsonModel);
|
||||
clean.post(jsonModel, frame);
|
||||
|
||||
if (frame.options && frame.options.withRelated) {
|
||||
|
@ -72,7 +72,10 @@ describe('Pages API', function () {
|
||||
.expect(201)
|
||||
.then((res) => {
|
||||
res.body.pages.length.should.eql(1);
|
||||
localUtils.API.checkResponse(res.body.pages[0], 'page', null, ['primary_tag', 'primary_author']);
|
||||
|
||||
// @NOTE: we do not return "excerpt" if custom_excerpt or plaintext is empty
|
||||
// @NOTE: we do not return primary_* if null
|
||||
localUtils.API.checkResponse(res.body.pages[0], 'page', null, ['primary_tag', 'primary_author', 'excerpt']);
|
||||
should.exist(res.headers['x-cache-invalidate']);
|
||||
|
||||
return models.Post.findOne({
|
||||
|
@ -29,8 +29,10 @@ const expectedProperties = {
|
||||
.without('visibility')
|
||||
.without('locale')
|
||||
.without('page')
|
||||
// always returns computed properties: url, comment_id, primary_tag, primary_author
|
||||
.without('author_id').concat('url', 'primary_tag', 'primary_author')
|
||||
// deprecated
|
||||
.without('author_id')
|
||||
// always returns computed properties
|
||||
.concat('url', 'primary_tag', 'primary_author', 'excerpt')
|
||||
,
|
||||
|
||||
page: _(schema.posts)
|
||||
@ -40,8 +42,10 @@ const expectedProperties = {
|
||||
.without('visibility')
|
||||
.without('locale')
|
||||
.without('page')
|
||||
// always returns computed properties: url, comment_id, primary_tag, primary_author
|
||||
.without('author_id').concat('url', 'primary_tag', 'primary_author')
|
||||
// deprecated
|
||||
.without('author_id')
|
||||
// always returns computed properties
|
||||
.concat('url', 'primary_tag', 'primary_author', 'excerpt')
|
||||
,
|
||||
|
||||
user: _(schema.users)
|
||||
|
Loading…
Reference in New Issue
Block a user