From a84c15689ebe30285f8544d278f227b0b6eedf2c Mon Sep 17 00:00:00 2001 From: Nazar Gargol Date: Fri, 21 Jun 2019 13:58:26 +0200 Subject: [PATCH] Renamved activate/serve methods as suggested in discussions --- core/frontend/services/settings/dynamic-routing.js | 8 ++++---- core/server/api/v0.1/settings.js | 4 ++-- core/server/api/v2/settings.js | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/core/frontend/services/settings/dynamic-routing.js b/core/frontend/services/settings/dynamic-routing.js index 116bc983fd..15f18db262 100644 --- a/core/frontend/services/settings/dynamic-routing.js +++ b/core/frontend/services/settings/dynamic-routing.js @@ -17,7 +17,7 @@ const config = require('../../../server/config'); * - we don't destroy the resources, we only release them (this avoids reloading all resources from the db again) * - then we reload the whole site app, which will reset all routers and re-create the url generators */ -const activate = (filePath) => { +const setFromFilePath = (filePath) => { const settingsPath = config.getContentPath('settings'); const backupRoutesPath = path.join(settingsPath, `routes-${moment().format('YYYY-MM-DD-HH-mm-ss')}.yaml`); @@ -77,7 +77,7 @@ const activate = (filePath) => { }); }; -const serve = () => { +const get = () => { const routesPath = path.join(config.getContentPath('settings'), 'routes.yaml'); return fs.readFile(routesPath, 'utf-8') @@ -96,5 +96,5 @@ const serve = () => { }); }; -module.exports.activate = activate; -module.exports.serve = serve; +module.exports.setFromFilePath = setFromFilePath; +module.exports.get = get; diff --git a/core/server/api/v0.1/settings.js b/core/server/api/v0.1/settings.js index 65d60130e6..4a67e14484 100644 --- a/core/server/api/v0.1/settings.js +++ b/core/server/api/v0.1/settings.js @@ -254,14 +254,14 @@ settings = { upload(options) { return localUtils.handlePermissions('settings', 'edit')(options) .then(() => { - return frontendSettings.dynamicRouting.activate(options.path); + return frontendSettings.dynamicRouting.setFromFilePath(options.path); }); }, download(options) { return localUtils.handlePermissions('settings', 'browse')(options) .then(() => { - return frontendSettings.dynamicRouting.serve(); + return frontendSettings.dynamicRouting.get(); }); } }; diff --git a/core/server/api/v2/settings.js b/core/server/api/v2/settings.js index 55eef7536a..beeea40639 100644 --- a/core/server/api/v2/settings.js +++ b/core/server/api/v2/settings.js @@ -147,7 +147,7 @@ module.exports = { method: 'edit' }, query(frame) { - return frontendSettings.dynamicRouting.activate(frame.file.path); + return frontendSettings.dynamicRouting.setFromFilePath(frame.file.path); } }, @@ -165,7 +165,7 @@ module.exports = { method: 'browse' }, query() { - return frontendSettings.dynamicRouting.serve(); + return frontendSettings.dynamicRouting.get(); } } };