0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Removed creation of single author on post creation

refs https://github.com/TryGhost/Toolbox/issues/230
This commit is contained in:
Naz 2022-04-26 20:37:17 +08:00 committed by naz
parent efc443a8d1
commit e8f20e5f12

View file

@ -85,19 +85,10 @@ module.exports.extendModel = function extendModel(Post, Posts, ghostBookshelf) {
return proto.onFetchingCollection.call(this, collection, attrs, options);
},
// NOTE: sending `post.author = {}` was always ignored [unsupported]
onCreating: function onCreating(model, attrs, options) {
if (!model.get('author_id')) {
if (model.get('authors')) {
model.set('author_id', model.get('authors')[0].id);
} else {
model.set('author_id', this.contextUser(options));
}
}
if (!model.get('authors')) {
model.set('authors', [{
id: model.get('author_id')
id: this.contextUser(options)
}]);
}