mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Moved toJSON
call to api v0.1 controller for ownership transfer
refs #9866
This commit is contained in:
parent
0a834d4223
commit
551f14d9ec
3 changed files with 3 additions and 8 deletions
|
@ -330,11 +330,9 @@ users = {
|
|||
*/
|
||||
function doQuery(options) {
|
||||
return models.User.transferOwnership(options.data.owner[0], _.omit(options, ['data']))
|
||||
.then((model) => {
|
||||
// NOTE: model returns json object already
|
||||
// @TODO: why?
|
||||
.then((models) => {
|
||||
return {
|
||||
users: model
|
||||
users: models.toJSON(_.omit(options, ['data']))
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
|
@ -899,10 +899,6 @@ User = ghostBookshelf.Model.extend({
|
|||
return Users.forge()
|
||||
.query('whereIn', 'id', [contextUser.id, results[2]])
|
||||
.fetch({withRelated: ['roles']});
|
||||
})
|
||||
.then(function then(users) {
|
||||
options.withRelated = ['roles'];
|
||||
return users.toJSON(options);
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -461,6 +461,7 @@ describe('User API', function () {
|
|||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.then((res) => {
|
||||
res.body.users.length.should.eql(2);
|
||||
res.body.users[0].roles[0].name.should.equal(testUtils.DataGenerator.Content.roles[0].name);
|
||||
res.body.users[1].roles[0].name.should.equal(testUtils.DataGenerator.Content.roles[3].name);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue