From 5888a5ffc455d61b89f0b4384fc0c0ba063584f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 12 Jul 2017 20:10:19 -0400 Subject: [PATCH] closes #5010 init plugin hooks before resetting widgets, the areas are returned by `filter:widgets.getAreas` --- src/reset.js | 13 ++++++++----- src/widgets/index.js | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/reset.js b/src/reset.js index 4b45821ddf..3d2fab2e0f 100644 --- a/src/reset.js +++ b/src/reset.js @@ -10,7 +10,6 @@ var events = require('./events'); var Reset = {}; - Reset.reset = function (callback) { db.init(function (err) { if (err) { @@ -163,10 +162,14 @@ function resetPlugins(callback) { } function resetWidgets(callback) { - require('./widgets').reset(function (err) { - winston.info('[reset] All Widgets moved to Draft Zone'); - callback(err); - }); + async.waterfall([ + require('./plugins').reload, + require('./widgets').reset, + function (next) { + winston.info('[reset] All Widgets moved to Draft Zone'); + next(); + }, + ], callback); } module.exports = Reset; diff --git a/src/widgets/index.js b/src/widgets/index.js index d14016cf42..9071989722 100644 --- a/src/widgets/index.js +++ b/src/widgets/index.js @@ -193,7 +193,7 @@ widgets.reset = function (callback) { function (results, next) { drafts = results.drafts || []; - async.each(results.areas, function (area, next) { + async.eachSeries(results.areas, function (area, next) { async.waterfall([ function (next) { widgets.getArea(area.template, area.location, next);