Changed comments and deprecation notes

refs #9742
This commit is contained in:
kirrg001 2018-08-03 15:14:38 +02:00 committed by Katharina Irrgang
parent 290f74f815
commit 52a9eebabf
15 changed files with 21 additions and 21 deletions

View File

@ -269,7 +269,7 @@ http = function http(apiMethod) {
var object = req.body,
options = _.extend({}, req.file, {ip: req.ip}, req.query, req.params, {
context: {
// @TODO: forward the client and user obj in 1.0 (options.context.user.id)
// @TODO: forward the client and user obj (options.context.user.id)
user: ((req.user && req.user.id) || (req.user && models.User.isExternalUser(req.user.id))) ? req.user.id : null,
client: (req.client && req.client.slug) ? req.client.slug : null,
client_id: (req.client && req.client.id) ? req.client.id : null

View File

@ -8,7 +8,7 @@ const Promise = require('bluebird'),
common = require('../lib/common'),
docName = 'posts',
/**
* @deprecated: `author`, will be removed in Ghost 2.0
* @deprecated: `author`, will be removed in Ghost 3.0
*/
allowedIncludes = [
'created_by', 'updated_by', 'published_by', 'author', 'tags', 'fields', 'authors', 'authors.roles'

View File

@ -334,7 +334,7 @@ utils = {
/**
* Convert author property to author_id to match the name in the database.
*
* @deprecated: `author`, will be removed in Ghost 2.0
* @deprecated: `author`, will be removed in Ghost 3.0
*/
if (object.posts[0].hasOwnProperty('author')) {
object.posts[0].author_id = object.posts[0].author;
@ -345,7 +345,7 @@ utils = {
* Ensure correct incoming `post.authors` structure.
*
* NOTE:
* The `post.authors[*].id` attribute is required till we release Ghost 2.0.
* The `post.authors[*].id` attribute is required till we release Ghost 3.0.
* Ghost 1.x keeps the deprecated support for `post.author_id`, which is the primary author id and needs to be
* updated if the order of the `post.authors` array changes.
* If we allow adding authors via the post endpoint e.g. `authors=[{name: 'newuser']` (no id property), it's hard
@ -357,7 +357,7 @@ utils = {
*
* TLDR; You can only attach existing authors to a post.
*
* @TODO: remove `id` restriction in Ghost 2.0
* @TODO: remove `id` restriction in Ghost 3.0
*/
if (object.posts[0].hasOwnProperty('authors')) {
if (!_.isArray(object.posts[0].authors) ||

View File

@ -70,7 +70,7 @@ DataImporter = {
});
}
// CASE: We deny LTS imports (from 1.0 we use the Ghost version you are on)
// CASE: We deny LTS imports. We can determine that because since Ghost 1.0 we export the Ghost version your blog is on.
// @TODO: add migration guide link
if (!semver.valid(importData.meta.version)) {
return Promise.reject(new common.errors.InternalServerError({

View File

@ -23,7 +23,7 @@ module.exports = {
meta_title: {type: 'string', maxlength: 2000, nullable: true, validations: {isLength: {max: 300}}},
meta_description: {type: 'string', maxlength: 2000, nullable: true, validations: {isLength: {max: 500}}},
/**
* @deprecated: `author_id`, will be (maybe) removed in Ghost 2.0
* @deprecated: `author_id`, might be removed in Ghost 3.0
* If we keep it, then only, because you can easier query post.author_id than posts_authors[*].sort_order.
*/
author_id: {type: 'string', maxlength: 24, nullable: false},

View File

@ -17,7 +17,7 @@ const proxy = require('./proxy'),
templates = proxy.templates;
/**
* @deprecated: will be removed in Ghost 2.0
* @deprecated: will be removed in Ghost 3.0
*/
module.exports = function author(options) {
if (options.fn) {

View File

@ -25,7 +25,7 @@ buildApiOptions = function buildApiOptions(options, post) {
order = options.name === 'prev_post' ? 'desc' : 'asc',
apiOptions = {
/**
* @deprecated: `author`, will be removed in Ghost 2.0
* @deprecated: `author`, will be removed in Ghost 3.0
*/
include: 'author,authors,tags',
order: 'published_at ' + order,

View File

@ -9,7 +9,7 @@ module.exports = {
let html = converters.markdownConverter.render(payload.markdown || '');
/**
* @deprecated Ghost 1.0's markdown-only renderer wrapped cards
* @deprecated Ghost 1.0's markdown-only renderer wrapped cards. Remove in Ghost 3.0
*/
if (version === 1) {
html = `<div class="kg-card-markdown">${html}</div>`;

View File

@ -162,7 +162,7 @@ filter = function filter(Bookshelf) {
}
/**
* @deprecated: `author`, will be removed in Ghost 2.0
* @deprecated: `author`, will be removed in Ghost 3.0
*/
if (joinTables && joinTables.indexOf('author') > -1) {
this

View File

@ -99,7 +99,7 @@ module.exports.extendModel = function extendModel(Post, Posts, ghostBookshelf) {
// NOTE: `post.author` was always ignored [unsupported]
onSaving: function (model, attrs, options) {
/**
* @deprecated: `author`, will be removed in Ghost 2.0
* @deprecated: `author`, will be removed in Ghost 3.0
*/
model.unset('author');
@ -164,7 +164,7 @@ module.exports.extendModel = function extendModel(Post, Posts, ghostBookshelf) {
/**
* CASE: `author` was requested, `posts.authors` must exist
* @deprecated: `author`, will be removed in Ghost 2.0
* @deprecated: `author`, will be removed in Ghost 3.0
*/
if (this._originalOptions.withRelated && this._originalOptions.withRelated && this._originalOptions.withRelated.indexOf('author') !== -1) {
if (!authors.models.length) {

View File

@ -35,7 +35,7 @@ class CollectionRouter extends ParentRouter {
this.limit = object.limit;
/**
* @deprecated Remove in Ghost 2.0
* @deprecated Remove in Ghost 3.0 (in discussion)
*/
if (this.permalinks.originalValue.match(/globals\.permalinks/)) {
this.permalinks.originalValue = this.permalinks.originalValue.replace('{globals.permalinks}', '{settings.permalinks}');
@ -122,7 +122,7 @@ class CollectionRouter extends ParentRouter {
_listeners() {
/**
* @deprecated Remove in Ghost 2.0
* @deprecated Remove in Ghost 3.0
*/
if (this.getPermalinks() && this.getPermalinks().originalValue.match(/settings\.permalinks/)) {
this._onPermalinksEditedListener = this._onPermalinksEdited.bind(this);

View File

@ -17,7 +17,7 @@ const queryDefaults = {
/**
* Default post query needs to always include author, authors & tags
*
* @deprecated: `author`, will be removed in Ghost 2.0
* @deprecated: `author`, will be removed in Ghost 3.0
*/
_.extend(defaultPostQuery, queryDefaults, {
options: {

View File

@ -33,7 +33,7 @@ function postLookup(postUrl, routerOptions) {
/**
* Query database to find post.
*
* @deprecated: `author`, will be removed in Ghost 2.0
* @deprecated: `author`, will be removed in Ghost 3.0
*/
return api.posts.read(_.extend(_.pick(params, 'slug', 'id'), {include: 'author,authors,tags'}))
.then(function then(result) {

View File

@ -94,7 +94,7 @@ _private.ThemeErrorRenderer = function ThemeErrorRenderer(err, req, res, next) {
// Format Data
var data = {
message: err.message,
// @deprecated
// @deprecated Remove in Ghost 3.0
code: err.statusCode,
statusCode: err.statusCode,
errorDetails: err.errorDetails || []

View File

@ -25,7 +25,7 @@ describe('Exporter', function () {
describe('doExport', function () {
beforeEach(function () {
exporter.__set__('ghostVersion', {
full: '1.0.0'
full: '2.0.0'
});
tablesStub = sandbox.stub(schema.commands, 'getTables').returns(schemaTables);
@ -52,7 +52,7 @@ describe('Exporter', function () {
should.exist(exportData);
exportData.meta.version.should.eql('1.0.0');
exportData.meta.version.should.eql('2.0.0');
tablesStub.calledOnce.should.be.true();
db.knex.called.should.be.true();
@ -97,7 +97,7 @@ describe('Exporter', function () {
should.exist(exportData);
exportData.meta.version.should.eql('1.0.0');
exportData.meta.version.should.eql('2.0.0');
tablesStub.calledOnce.should.be.true();
db.knex.called.should.be.true();