Skip to content

Commit af46e15

Browse files
author
Martii
committed
Controllers completed, I believe, and some testing on dev... still have libs to do.
* Changed "WARNING" on login page to "CAUTION"... a little too assertive... some users may want their email addy in there. * Notated some STYLEGUIDE conformance needs * Notated very short function name(s) * At least one undefined identifier
1 parent dd9a807 commit af46e15

File tree

5 files changed

+742
-741
lines changed

5 files changed

+742
-741
lines changed

controllers/remove.js

+14-14
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,36 @@ var User = require('../models/user').User;
66
var destroySessions = require('../libs/modifySessions').destroy;
77

88
// Simple controller to remove content and save it in the graveyard
9-
exports.rm = function (req, res, next) {
10-
var type = req.route.params[0];
11-
var path = req.route.params[1];
12-
var thisUser = req.session.user;
9+
exports.rm = function (aReq, aRes, aNext) {
10+
var type = aReq.route.params[0];
11+
var path = aReq.route.params[1];
12+
var thisUser = aReq.session.user;
1313

1414
switch (type) {
1515
case 'scripts':
1616
case 'libs':
1717
path += type === 'libs' ? '.js' : '.user.js';
18-
Script.findOne({ installName: path }, function (err, script) {
19-
removeLib.remove(Script, script, thisUser, '', function (removed) {
20-
if (!removed) { return next(); }
21-
res.redirect('/');
18+
Script.findOne({ installName: path }, function (aErr, aScript) {
19+
removeLib.remove(Script, aScript, thisUser, '', function (aRemoved) {
20+
if (!aRemoved) { return aNext(); }
21+
aRes.redirect('/');
2222
});
2323
});
2424
break;
2525
case 'users':
2626
User.findOne({ name: { $regex: new RegExp('^' + path + '$', "i") } },
27-
function (err, user) {
28-
removeLib.remove(User, user, thisUser, '', function (removed) {
29-
if (!removed) { return next(); }
27+
function (aErr, aUser) {
28+
removeLib.remove(User, aUser, thisUser, '', function (aRemoved) {
29+
if (!aRemoved) { return aNext(); }
3030

3131
// Destory all the sessions belonging to the removed user
32-
destroySessions(req, user, function () {
33-
res.redirect('/');
32+
destroySessions(aReq, aUser, function () {
33+
aRes.redirect('/');
3434
});
3535
});
3636
});
3737
break;
3838
default:
39-
next();
39+
aNext();
4040
}
4141
};

0 commit comments

Comments
 (0)