From bc4b637e30c4e7a0f47d47e66639d0947d201cc0 Mon Sep 17 00:00:00 2001 From: kirrg001 Date: Thu, 20 Sep 2018 17:36:47 +0200 Subject: [PATCH] Refactored direct usages of api controllers refs #9866 - if we start with v2 controllers, the code base should not require specific api controllers - because e.g. `require('../api/posts')` will no longer exist - if you require the api folder, you will get the latest available version by default e.g. `require('../api').posts` - this branch does not touch the test env (!) --- core/server/adapters/scheduling/post-scheduling/index.js | 4 ++-- core/server/api/schedules.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/server/adapters/scheduling/post-scheduling/index.js b/core/server/adapters/scheduling/post-scheduling/index.js index 15ba3db0b6..491152bf0d 100644 --- a/core/server/adapters/scheduling/post-scheduling/index.js +++ b/core/server/adapters/scheduling/post-scheduling/index.js @@ -3,7 +3,6 @@ const Promise = require('bluebird'), localUtils = require('../utils'), common = require('../../../lib/common'), models = require('../../../models'), - schedules = require('../../../api/schedules'), urlService = require('../../../services/url'), _private = {}; @@ -25,7 +24,8 @@ _private.loadClient = function loadClient() { }; _private.loadScheduledPosts = function () { - return schedules.getScheduledPosts() + const api = require('../../../api'); + return api.schedules.getScheduledPosts() .then((result) => { return result.posts || []; }); diff --git a/core/server/api/schedules.js b/core/server/api/schedules.js index 849b1c2493..4db821f910 100644 --- a/core/server/api/schedules.js +++ b/core/server/api/schedules.js @@ -6,7 +6,7 @@ const Promise = require('bluebird'), models = require('../models'), config = require('../config'), common = require('../lib/common'), - postsAPI = require('../api/posts'); + postsAPI = require('./posts'); /** * Publish a scheduled post