From 521c454dde71cdde24327b14b1473aa554b4feeb Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 17 Mar 2015 11:29:19 -0400 Subject: [PATCH 1/6] updated emailer to pass through "fromUid" if available --- src/emailer.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/emailer.js b/src/emailer.js index b358e170fb..aeca1ecab8 100644 --- a/src/emailer.js +++ b/src/emailer.js @@ -62,7 +62,8 @@ var fs = require('fs'), plaintext: translated[1], template: template, uid: uid, - pid: params.pid + pid: params.pid, + fromUid: params.fromUid }); callback(); } else { From 9fc97ce92d24f22cf6f73776b1bcc22737ac6242 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 17 Mar 2015 12:01:55 -0400 Subject: [PATCH 2/6] fixing handleACPRedirect on subfolder installs --- public/src/ajaxify.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index 6178587423..809d2d9db9 100644 --- a/public/src/ajaxify.js +++ b/public/src/ajaxify.js @@ -64,7 +64,7 @@ $(document).ready(function() { ajaxify.handleACPRedirect = function(url) { // If ajaxifying into an admin route from regular site, do a cold load. url = ajaxify.removeRelativePath(url.replace(/\/$/, '')); - if (url.indexOf('admin') === 0 && window.location.pathname.indexOf('/admin') !== 0) { + if (url.indexOf('admin') === 0 && window.location.pathname.indexOf(RELATIVE_PATH + '/admin') !== 0) { window.open(RELATIVE_PATH + '/' + url, '_blank'); return true; } From 406126536a4117d558cf06428ad20f5a541e03c2 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 17 Mar 2015 12:02:33 -0400 Subject: [PATCH 3/6] missing semicolon --- public/src/ajaxify.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index 809d2d9db9..75e341643e 100644 --- a/public/src/ajaxify.js +++ b/public/src/ajaxify.js @@ -69,7 +69,7 @@ $(document).ready(function() { return true; } return false; - } + }; ajaxify.start = function(url, quiet, search) { url = ajaxify.removeRelativePath(url.replace(/\/$/, '')); From 56ed6d211250019ccb08f19e3e319daf036e5dd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Tue, 17 Mar 2015 13:09:19 -0400 Subject: [PATCH 4/6] shorter bcrypt --- bcrypt.js | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/bcrypt.js b/bcrypt.js index 1445999a8a..ae81d09eb7 100644 --- a/bcrypt.js +++ b/bcrypt.js @@ -9,11 +9,10 @@ process.on('message', function(msg) { if (msg.type === 'hash') { hashPassword(msg.password, msg.rounds); } else if (msg.type === 'compare') { - compare(msg.password, msg.hash); + bcrypt.compare(msg.password, msg.hash, done); } }); - function hashPassword(password, rounds) { async.waterfall([ function(next) { @@ -22,23 +21,14 @@ function hashPassword(password, rounds) { function(salt, next) { bcrypt.hash(password, salt, next); } - ], function(err, hash) { - if (err) { - process.send({err: err.message}); - return process.disconnect(); - } - process.send({result: hash}); - process.disconnect(); - }); + ], done); } -function compare(password, hash) { - bcrypt.compare(password, hash, function(err, res) { - if (err) { - process.send({err: err.message}); - return process.disconnect(); - } - process.send({result: res}); - process.disconnect(); - }); +function done(err, result) { + if (err) { + process.send({err: err.message}); + return process.disconnect(); + } + process.send({result: result}); + process.disconnect(); } \ No newline at end of file From 839dd72a05354b7eb6485d275f9624f5defd2d35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Tue, 17 Mar 2015 13:15:36 -0400 Subject: [PATCH 5/6] been a while since we stopped using hashes --- src/routes/feeds.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/routes/feeds.js b/src/routes/feeds.js index 0f2f6082b6..e015b91e21 100644 --- a/src/routes/feeds.js +++ b/src/routes/feeds.js @@ -84,7 +84,7 @@ function generateForTopic(req, res, next) { feed.item({ title: 'Reply to ' + topicData.title + ' on ' + dateStamp, description: postData.content, - url: nconf.get('url') + '/topic/' + topicData.slug + '#' + postData.pid, + url: nconf.get('url') + '/topic/' + topicData.slug + '/' + postData.index, author: postData.username, date: dateStamp }); @@ -144,8 +144,8 @@ function generateForCategory(req, res, next) { if (err) { return next(err); } - sendFeed(feed, res); - }); + sendFeed(feed, res); + }); }); } @@ -183,8 +183,8 @@ function generateForPopular(req, res, next) { return next(err); } sendFeed(feed, res); - }); - }); + }); + }); } function disabledRSS(req, res, next) { @@ -201,13 +201,13 @@ function generateForTopics(options, set, req, res, next) { if (err) { return next(err); } - + generateTopicsFeed(options, data.topics, function(err, feed) { if (err) { return next(err); } - sendFeed(feed, res); - }); + sendFeed(feed, res); + }); }); } @@ -215,7 +215,7 @@ function generateTopicsFeed(feedOptions, feedTopics, callback) { var tids = feedTopics.map(function(topic) { return topic ? topic.tid : null; }); - + topics.getMainPids(tids, function(err, pids) { if (err) { return callback(err); @@ -252,7 +252,7 @@ function generateTopicsFeed(feedOptions, feedTopics, callback) { }); callback(null, feed); }); - }); + }); } function generateForRecentPosts(req, res, next) { From e45e204ba5f560e75a79fe5732f308787f1c8e63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Tue, 17 Mar 2015 13:21:27 -0400 Subject: [PATCH 6/6] fix author field on topic feed #2872 --- src/routes/feeds.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/feeds.js b/src/routes/feeds.js index e015b91e21..58d44cbce5 100644 --- a/src/routes/feeds.js +++ b/src/routes/feeds.js @@ -84,8 +84,8 @@ function generateForTopic(req, res, next) { feed.item({ title: 'Reply to ' + topicData.title + ' on ' + dateStamp, description: postData.content, - url: nconf.get('url') + '/topic/' + topicData.slug + '/' + postData.index, - author: postData.username, + url: nconf.get('url') + '/topic/' + topicData.slug + (postData.index ? '/' + (postData.index + 1) : ''), + author: postData.user ? postData.user.username : '', date: dateStamp }); }