diff --git a/core/server/models/relations/authors.js b/core/server/models/relations/authors.js index aae2e9af8a..0bbdc06cda 100644 --- a/core/server/models/relations/authors.js +++ b/core/server/models/relations/authors.js @@ -17,10 +17,6 @@ const messages = { * We fetch the `authors` relations when you either request `withRelated=['authors']` or `withRelated=['author`]. * The old `author` relation was removed, but we still have to support this case. * - * # CASE 2: - * If you request `include=author`, we have to fill this object with `post.authors[0]`. - * Otherwise we can't return `post.author = User`. - * * --- * * It's impossible to implement a default `withRelated` feature nicely at the moment, because we can't hook into bookshelf @@ -133,7 +129,6 @@ module.exports.extendModel = function extendModel(Post, Posts, ghostBookshelf) { }, serialize: function serialize(options) { - const authors = this.related('authors'); let attrs = proto.serialize.call(this, options); // CASE: e.g. you stub model response in the test @@ -142,20 +137,6 @@ module.exports.extendModel = function extendModel(Post, Posts, ghostBookshelf) { this._originalOptions = {}; } - /** - * CASE: `author` was requested, `posts.authors` must exist - * @deprecated: single authors was superceded by multiple authors in Ghost 1.22.0 - */ - if (this._originalOptions.withRelated && this._originalOptions.withRelated && this._originalOptions.withRelated.indexOf('author') !== -1) { - if (!authors.models.length) { - throw new errors.ValidationError({ - message: 'The target post has no primary author.' - }); - } - - attrs.author = attrs.authors[0]; - } - // CASE: `posts.authors` was not requested, but fetched in specific cases (see top) if (!this._originalOptions || !this._originalOptions.withRelated || this._originalOptions.withRelated.indexOf('authors') === -1) { delete attrs.authors;