Loading opt/comments-server-side/ForumUser.js +2 −2 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ ForumUser.prototype = { return; } var user = self.getUserFromResult(results[0]) var user = self.getUserFromResult(results[0]); callback(null, user); } Loading @@ -50,7 +50,7 @@ ForumUser.prototype = { userName: user.username, userId: user.userid, mod: _.include(user.membergroupids, 7) } }; }, checkPassword: function(password, salt, saltedPassword) { Loading opt/comments-server-side/app.js +5 −5 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ config = require('./config'); mongoose = require('mongoose'); require('./database'); require('express-namespace') require('express-namespace'); var mysql = require('mysql'), client = mysql.createClient({ Loading Loading @@ -165,7 +165,7 @@ app.namespace('/auth/:sdk/:version', function(){ } else { return; } } }; var reduce = function(key, values) { var i = 0, total = 0; Loading @@ -175,7 +175,7 @@ app.namespace('/auth/:sdk/:version', function(){ } return total; } }; mongoose.connection.db.executeDbCommand({ mapreduce: 'comments', Loading @@ -190,7 +190,7 @@ app.namespace('/auth/:sdk/:version', function(){ }, function(err, dbres) { mongoose.connection.db.collection('commentCounts', function(err, collection) { collection.find({}).toArray(function(err, comments) { res.send(comments) res.send(comments); }); }); }); Loading Loading @@ -227,7 +227,7 @@ app.namespace('/auth/:sdk/:version', function(){ emaiHash: crypto.createHash('md5').update(req.session.user.email).digest("hex"), sdk: req.params.sdk, version: req.params.version }) }); comment.save(function(err, response) { res.json({ success: true, id: response._id, action: req.body.action }); Loading opt/comments-server-side/util.js +7 −7 Original line number Diff line number Diff line Loading @@ -23,14 +23,14 @@ exports.sanitize = function(content, opts) { } else { return ''; } } }; } sanitized_output = sanitizer.sanitize(markdowned, urlFunc); sanitized_output = sanitized_output.replace(/'/g, '''); return sanitized_output; } }; exports.formatComments = function(comments, req) { Loading @@ -47,8 +47,8 @@ exports.formatComments = function(comments, req) { } return comment; }) } }); }; exports.vote = function(req, res, comment) { Loading Loading @@ -93,7 +93,7 @@ exports.vote = function(req, res, comment) { total: (comment.upVotes.length - comment.downVotes.length) }); }); } }; exports.requireLoggedInUser = function(req, res, next) { Loading @@ -103,7 +103,7 @@ exports.requireLoggedInUser = function(req, res, next) { } else { next(); } } }; exports.findComment = function(req, res, next) { Loading @@ -116,7 +116,7 @@ exports.findComment = function(req, res, next) { res.json({success: false, reason: 'No such comment'}); } } }; Loading Loading
opt/comments-server-side/ForumUser.js +2 −2 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ ForumUser.prototype = { return; } var user = self.getUserFromResult(results[0]) var user = self.getUserFromResult(results[0]); callback(null, user); } Loading @@ -50,7 +50,7 @@ ForumUser.prototype = { userName: user.username, userId: user.userid, mod: _.include(user.membergroupids, 7) } }; }, checkPassword: function(password, salt, saltedPassword) { Loading
opt/comments-server-side/app.js +5 −5 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ config = require('./config'); mongoose = require('mongoose'); require('./database'); require('express-namespace') require('express-namespace'); var mysql = require('mysql'), client = mysql.createClient({ Loading Loading @@ -165,7 +165,7 @@ app.namespace('/auth/:sdk/:version', function(){ } else { return; } } }; var reduce = function(key, values) { var i = 0, total = 0; Loading @@ -175,7 +175,7 @@ app.namespace('/auth/:sdk/:version', function(){ } return total; } }; mongoose.connection.db.executeDbCommand({ mapreduce: 'comments', Loading @@ -190,7 +190,7 @@ app.namespace('/auth/:sdk/:version', function(){ }, function(err, dbres) { mongoose.connection.db.collection('commentCounts', function(err, collection) { collection.find({}).toArray(function(err, comments) { res.send(comments) res.send(comments); }); }); }); Loading Loading @@ -227,7 +227,7 @@ app.namespace('/auth/:sdk/:version', function(){ emaiHash: crypto.createHash('md5').update(req.session.user.email).digest("hex"), sdk: req.params.sdk, version: req.params.version }) }); comment.save(function(err, response) { res.json({ success: true, id: response._id, action: req.body.action }); Loading
opt/comments-server-side/util.js +7 −7 Original line number Diff line number Diff line Loading @@ -23,14 +23,14 @@ exports.sanitize = function(content, opts) { } else { return ''; } } }; } sanitized_output = sanitizer.sanitize(markdowned, urlFunc); sanitized_output = sanitized_output.replace(/'/g, '''); return sanitized_output; } }; exports.formatComments = function(comments, req) { Loading @@ -47,8 +47,8 @@ exports.formatComments = function(comments, req) { } return comment; }) } }); }; exports.vote = function(req, res, comment) { Loading Loading @@ -93,7 +93,7 @@ exports.vote = function(req, res, comment) { total: (comment.upVotes.length - comment.downVotes.length) }); }); } }; exports.requireLoggedInUser = function(req, res, next) { Loading @@ -103,7 +103,7 @@ exports.requireLoggedInUser = function(req, res, next) { } else { next(); } } }; exports.findComment = function(req, res, next) { Loading @@ -116,7 +116,7 @@ exports.findComment = function(req, res, next) { res.json({success: false, reason: 'No such comment'}); } } }; Loading