From 2fc26bd80a047e019597aca9512a9ce1126bcde6 Mon Sep 17 00:00:00 2001 From: Naz Date: Mon, 27 Sep 2021 16:49:00 +0200 Subject: [PATCH] Removed unnecessary async statements refs https://linear.app/tryghost/issue/CORE-35/refactor-route-and-redirect-settings - These methods are completely sync, there's no need to complicate it with artificial "async" method signatures. Even if used in then chains or with await these methods should still work! --- .../services/route-settings/route-settings.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/core/server/services/route-settings/route-settings.js b/core/server/services/route-settings/route-settings.js index a982832340..7a8868961b 100644 --- a/core/server/services/route-settings/route-settings.js +++ b/core/server/services/route-settings/route-settings.js @@ -32,17 +32,13 @@ const messages = { const filename = 'routes'; const ext = 'yaml'; -const getSettingsFolder = async () => { - return config.getContentPath('settings'); -}; - -const getSettingsFilePath = async () => { - const settingsFolder = await getSettingsFolder(); +const getSettingsFilePath = () => { + const settingsFolder = config.getContentPath('settings'); return path.join(settingsFolder, `${filename}.${ext}`); }; -const getBackupFilePath = async () => { - const settingsFolder = await getSettingsFolder(); +const getBackupFilePath = () => { + const settingsFolder = config.getContentPath('settings'); return path.join(settingsFolder, `${filename}-${moment().format('YYYY-MM-DD-HH-mm-ss')}.${ext}`); }; @@ -76,8 +72,8 @@ const readFile = (settingsFilePath) => { }; const setFromFilePath = async (filePath) => { - const settingsPath = await getSettingsFilePath(); - const backupPath = await getBackupFilePath(); + const settingsPath = getSettingsFilePath(); + const backupPath = getBackupFilePath(); await createBackupFile(settingsPath, backupPath); await saveFile(filePath, settingsPath);