Skip to content

Commit 10a15a5

Browse files
committed
Merge pull request #818 from Martii/controllersMisc
Additional whitespace cleanup for controllers Auto-merge
2 parents 84e0742 + 00d0e20 commit 10a15a5

File tree

8 files changed

+53
-31
lines changed

8 files changed

+53
-31
lines changed

controllers/admin.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ exports.apiAdminUpdate = function (aReq, aRes, aNext) {
407407
delete strategyInstances[name];
408408
aCallback();
409409
});
410+
410411
return;
411412
} else if (id && key) {
412413
if (stored[name]) {
@@ -482,12 +483,13 @@ exports.authAsUser = function (aReq, aRes, aNext) {
482483
options.user = user = modelParser.parseUser(aUser);
483484

484485
if (authedUser.role >= user.role) {
485-
return statusCodePage(aReq, aRes, aNext, {
486+
statusCodePage(aReq, aRes, aNext, {
486487
statusCode: 403,
487488
statusMessage: authedUser.role == user.role
488489
? 'Cannot auth as a user with the same rank.'
489490
: 'Cannot auth as a user with a higher rank.',
490491
});
492+
return;
491493
}
492494

493495
aReq.session.user = user;

controllers/auth.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@ exports.callback = function (aReq, aRes, aNext) {
236236
addSession(aReq, aUser, function () {
237237
if (newstrategy && newstrategy !== strategy) {
238238
// Allow a user to link to another account
239-
return aRes.redirect('/auth/' + newstrategy);
239+
aRes.redirect('/auth/' + newstrategy);
240+
return;
240241
} else {
241242
// Delete the username that was temporarily stored
242243
delete aReq.session.username;

controllers/discussion.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,8 @@ exports.show = function (aReq, aRes, aNext) {
313313
var tasks = [];
314314

315315
if (!aDiscussionData) {
316-
return aNext();
316+
aNext();
317+
return;
317318
}
318319

319320
// Session

controllers/document.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,13 @@ exports.view = function (aReq, aRes, aNext) {
176176
});
177177

178178
// Read git branch name of current tree
179-
tasks.push(
180-
function (aCallback) {
181-
git.branch(function (aStr) {
182-
options.git.branch = aStr;
183-
184-
aCallback(null);
185-
});
186-
}
187-
);
179+
tasks.push(function (aCallback) {
180+
git.branch(function (aStr) {
181+
options.git.branch = aStr;
182+
183+
aCallback(null);
184+
});
185+
});
188186
}
189187

190188
//---

controllers/issue.js

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ exports.list = function (aReq, aRes, aNext) {
101101
var tasks = [];
102102

103103
if (aErr || !aScript) {
104-
return aNext();
104+
aNext();
105+
return;
105106
}
106107

107108
// Session
@@ -203,7 +204,8 @@ exports.view = function (aReq, aRes, aNext) {
203204
var tasks = [];
204205

205206
if (aErr || !aScript) {
206-
return aNext();
207+
aNext();
208+
return;
207209
}
208210

209211
// Session
@@ -260,7 +262,8 @@ exports.view = function (aReq, aRes, aNext) {
260262
var scriptOpenIssueCountQuery = null;
261263

262264
if (aErr || !aDiscussion) {
263-
return aNext();
265+
aNext();
266+
return;
264267
}
265268

266269
// Discussion
@@ -331,7 +334,8 @@ exports.open = function (aReq, aRes, aNext) {
331334

332335
// ---
333336
if (aErr || !aScript) {
334-
return aNext();
337+
aNext();
338+
return;
335339
}
336340

337341
//
@@ -364,18 +368,21 @@ exports.open = function (aReq, aRes, aNext) {
364368

365369
if (topic && content) {
366370
if (!topic.trim() || !content.trim()) {
367-
return statusCodePage(aReq, aRes, aNext, {
371+
statusCodePage(aReq, aRes, aNext, {
368372
statusCode: 403,
369373
statusMessage: 'You cannot post an empty issue topic to this ' +
370374
(type === 'libs' ? 'library' : 'script')
371375
});
376+
return;
372377
}
373378

374379
// Issue Submission
375380
discussionLib.postTopic(authedUser, category.slug, topic, content, true,
376381
function (aDiscussion) {
377-
if (!aDiscussion)
378-
return aRes.redirect('/' + encodeURI(category) + '/open');
382+
if (!aDiscussion) {
383+
aRes.redirect('/' + encodeURI(category) + '/open');
384+
return;
385+
}
379386

380387
aRes.redirect(encodeURI(aDiscussion.path +
381388
(aDiscussion.duplicateId ? '_' + aDiscussion.duplicateId : '')));
@@ -408,22 +415,25 @@ exports.comment = function (aReq, aRes, aNext) {
408415
var topic = aReq.params.topic;
409416

410417
if (aErr || !aScript) {
411-
return aNext();
418+
aNext();
419+
return;
412420
}
413421

414422
if (!content || !content.trim()) {
415-
return statusCodePage(aReq, aRes, aNext, {
423+
statusCodePage(aReq, aRes, aNext, {
416424
statusCode: 403,
417425
statusMessage: 'You cannot post an empty comment to this issue'
418426
});
427+
return;
419428
}
420429

421430
discussionLib.findDiscussion(category, topic, function (aIssue) {
422431
//
423432
var authedUser = aReq.session.user;
424433

425434
if (!aIssue) {
426-
return aNext();
435+
aNext();
436+
return;
427437
}
428438

429439
discussionLib.postComment(authedUser, aIssue, content, false,
@@ -449,14 +459,16 @@ exports.changeStatus = function (aReq, aRes, aNext) {
449459
var changed = false;
450460

451461
if (aErr || !aScript) {
452-
return aNext();
462+
aNext();
463+
return;
453464
}
454465

455466
discussionLib.findDiscussion(category, topic, function (aIssue) {
456467
var authedUser = aReq.session.user;
457468

458469
if (!aIssue) {
459-
return aNext();
470+
aNext();
471+
return;
460472
}
461473

462474
// Both the script author and the issue creator can close the issue

controllers/remove.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ exports.rm = function (aReq, aRes, aNext) {
3232

3333
// Check to make sure multipart form data submission header is present
3434
if (!/multipart\/form-data/.test(aReq.headers['content-type'])) {
35-
return statusCodePage(aReq, aRes, aNext, {
35+
statusCodePage(aReq, aRes, aNext, {
3636
statusCode: 400,
3737
statusMessage: 'Missing required header.'
3838
});
39+
return;
3940
}
4041

4142
form = new formidable.IncomingForm();
@@ -51,19 +52,21 @@ exports.rm = function (aReq, aRes, aNext) {
5152
// This occurs either when no reason is supplied,
5253
// or a rare edge case if the view is missing the input name.
5354
if (!reason) {
54-
return statusCodePage(aReq, aRes, aNext, {
55+
statusCodePage(aReq, aRes, aNext, {
5556
statusCode: 403,
5657
statusMessage: 'Missing reason for removal.'
5758
});
59+
return;
5860
}
5961

6062
// Simple error check for string null
6163
reason = reason.trim();
6264
if (reason === '') {
63-
return statusCodePage(aReq, aRes, aNext, {
65+
statusCodePage(aReq, aRes, aNext, {
6466
statusCode: 403,
6567
statusMessage: 'Invalid reason for removal.'
6668
});
69+
return;
6770
}
6871

6972
switch (type) {
@@ -73,7 +76,8 @@ exports.rm = function (aReq, aRes, aNext) {
7376
Script.findOne({ installName: path }, function (aErr, aScript) {
7477
removeLib.remove(Script, aScript, authedUser, reason, function (aRemoved) {
7578
if (!aRemoved) {
76-
return aNext();
79+
aNext();
80+
return;
7781
}
7882
aRes.redirect('/');
7983
});
@@ -84,7 +88,8 @@ exports.rm = function (aReq, aRes, aNext) {
8488
function (aErr, aUser) {
8589
removeLib.remove(User, aUser, authedUser, reason, function (aRemoved) {
8690
if (!aRemoved) {
87-
return aNext();
91+
aNext();
92+
return;
8893
}
8994

9095
// Destroy all the sessions belonging to the removed user

controllers/script.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,8 @@ var getScriptPageTasks = function (aOptions) {
276276
aOptions.removeUrl = '/remove' + (script.isLib ? '/libs/' : '/scripts/') + script.installNameSlug;
277277

278278
if (!aCanRemove) {
279-
return aCallback();
279+
aCallback();
280+
return;
280281
}
281282

282283
flagLib.getThreshold(Script, script, aAuthor, function (aThreshold) {

controllers/user.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,9 @@ exports.userEditPreferencesPage = function (aReq, aRes, aNext) {
783783

784784
// Get the strategies we have OAuth keys for
785785
aStrats.forEach(function (aStrat) {
786-
if (aStrat.name === defaultStrategy) { return; }
786+
if (aStrat.name === defaultStrategy) {
787+
return;
788+
}
787789

788790
if (userStrats.indexOf(aStrat.name) > -1) {
789791
options.usedStrategies.push({

0 commit comments

Comments
 (0)