mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 03:55:55 +01:00
Added req and res objects to the widget rendering process before callback in src/controllers/api.js
This commit is contained in:
@@ -114,11 +114,15 @@ apiController.renderWidgets = function(req, res, next) {
|
|||||||
return res.status(200).json({});
|
return res.status(200).json({});
|
||||||
}
|
}
|
||||||
|
|
||||||
widgets.render(req.uid, {
|
widgets.render(req.uid,
|
||||||
template: areas.template,
|
{
|
||||||
url: areas.url,
|
template: areas.template,
|
||||||
locations: areas.locations
|
url: areas.url,
|
||||||
}, function(err, widgets) {
|
locations: areas.locations,
|
||||||
|
},
|
||||||
|
req,
|
||||||
|
res,
|
||||||
|
function(err, widgets) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ var async = require('async'),
|
|||||||
|
|
||||||
var widgets = {};
|
var widgets = {};
|
||||||
|
|
||||||
widgets.render = function(uid, area, callback) {
|
widgets.render = function(uid, area, req, res, callback) {
|
||||||
if (!area.locations || !area.template) {
|
if (!area.locations || !area.template) {
|
||||||
return callback(new Error('[[error:invalid-data]]'));
|
return callback(new Error('[[error:invalid-data]]'));
|
||||||
}
|
}
|
||||||
@@ -37,7 +37,9 @@ widgets.render = function(uid, area, callback) {
|
|||||||
plugins.fireHook('filter:widget.render:' + widget.widget, {
|
plugins.fireHook('filter:widget.render:' + widget.widget, {
|
||||||
uid: uid,
|
uid: uid,
|
||||||
area: area,
|
area: area,
|
||||||
data: widget.data
|
data: widget.data,
|
||||||
|
req: req,
|
||||||
|
res: res
|
||||||
}, function(err, html) {
|
}, function(err, html) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return next(err);
|
return next(err);
|
||||||
|
|||||||
Reference in New Issue
Block a user