Node.js based forum software built for the modern web
closes #1734
barisusakliab6429c578d4
diff --git a/public/src/widgets.js b/public/src/widgets.jsindex 46b8d6fed3..4c035e5c0f 100644--- a/public/src/widgets.js+++ b/public/src/widgets.js@@ -31,24 +31,16 @@}function renderWidgets(location) {- // remove when https://code.google.com/p/chromium/issues/detail?id=357625 is fixed- try {- var temp = localStorage.getItem('cache:widgets:' + url + ':' + location);- } catch (e) {- var temp = null;- }-- var area = $('#content [widget-area="' + location + '"]')- .html(temp);-+ var area = $('#content [widget-area="' + location + '"]');socket.emit('widgets.render', {template: tpl_url + '.tpl', url: url, location: location}, function(err, renderedWidgets) {+ if (err) {+ return;+ }var html = '';- for (var widget in renderedWidgets) {- if (renderedWidgets.hasOwnProperty(widget)) {- html += templates.parse(renderedWidgets[widget].html, {});- }+ for (var i=0; i<renderedWidgets.length; ++i) {+ html += templates.parse(renderedWidgets[i].html, {});}if (!area.length && window.location.pathname.indexOf('/admin') === -1 && renderedWidgets.length) {@@ -65,11 +57,7 @@}area.html(html);- // remove when https://code.google.com/p/chromium/issues/detail?id=357625 is fixed- try {- localStorage.setItem('cache:widgets:' + url + ':' + location, html);- } catch (e) {}-+if (!renderedWidgets.length) {area.addClass('hidden');ajaxify.widgets.reposition(location);@@ -90,10 +78,8 @@}}- for (var i in widgetLocations) {- if (widgetLocations.hasOwnProperty(i)) {- renderWidgets(widgetLocations[i]);- }+ for (var i=0; i<widgetLocations.length; ++i) {+ renderWidgets(widgetLocations[i]);}checkCallback();diff --git a/src/routes/api.js b/src/routes/api.jsindex 354c3d640b..62726d9470 100644--- a/src/routes/api.js+++ b/src/routes/api.js@@ -25,23 +25,23 @@ function deleteTempFiles(files) {function upload(req, res, filesIterator, next) {var files = req.files.files;- if(!req.user) {+ if (!req.user) {deleteTempFiles(files);- return res.json(403, {message:'not allowed'});+ return res.json(403, 'not allowed');}- if(!Array.isArray(files)) {- return res.json(500, {message: 'invalid files'});+ if (!Array.isArray(files)) {+ return res.json(500, 'invalid files');}- if(Array.isArray(files[0])) {+ if (Array.isArray(files[0])) {files = files[0];}async.map(files, filesIterator, function(err, images) {deleteTempFiles(files);- if(err) {+ if (err) {return res.send(500, err.message);}