From 44c4925ceba2d435474a32797f531e79681c9eca Mon Sep 17 00:00:00 2001 From: Jon Garrison Date: Wed, 16 Sep 2015 00:36:13 -0700 Subject: [PATCH 1/2] Added req and res objects to the widget rendering process before callback in src/controllers/api.js --- src/controllers/api.js | 14 +++++++++----- src/widgets/index.js | 6 ++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/controllers/api.js b/src/controllers/api.js index 5af74d2ed6..db91162eb9 100644 --- a/src/controllers/api.js +++ b/src/controllers/api.js @@ -114,11 +114,15 @@ apiController.renderWidgets = function(req, res, next) { return res.status(200).json({}); } - widgets.render(req.uid, { - template: areas.template, - url: areas.url, - locations: areas.locations - }, function(err, widgets) { + widgets.render(req.uid, + { + template: areas.template, + url: areas.url, + locations: areas.locations, + }, + req, + res, + function(err, widgets) { if (err) { return next(err); } diff --git a/src/widgets/index.js b/src/widgets/index.js index fffc704e5f..f031f47e11 100644 --- a/src/widgets/index.js +++ b/src/widgets/index.js @@ -10,7 +10,7 @@ var async = require('async'), var widgets = {}; -widgets.render = function(uid, area, callback) { +widgets.render = function(uid, area, req, res, callback) { if (!area.locations || !area.template) { return callback(new Error('[[error:invalid-data]]')); } @@ -37,7 +37,9 @@ widgets.render = function(uid, area, callback) { plugins.fireHook('filter:widget.render:' + widget.widget, { uid: uid, area: area, - data: widget.data + data: widget.data, + req: req, + res: res }, function(err, html) { if (err) { return next(err); From 47714151b178d198cafcf5911ad1cc4797483949 Mon Sep 17 00:00:00 2001 From: Jon Garrison Date: Wed, 16 Sep 2015 00:46:11 -0700 Subject: [PATCH 2/2] fixed one tab character --- src/controllers/api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controllers/api.js b/src/controllers/api.js index db91162eb9..7c106431c7 100644 --- a/src/controllers/api.js +++ b/src/controllers/api.js @@ -119,7 +119,7 @@ apiController.renderWidgets = function(req, res, next) { template: areas.template, url: areas.url, locations: areas.locations, - }, + }, req, res, function(err, widgets) {