Update eslint, fix lint issues
This commit is contained in:
13
.eslintrc
13
.eslintrc
@ -1,6 +1,9 @@
|
||||
{
|
||||
"parserOption": {
|
||||
"ecmaVersion": 6,
|
||||
"ecmaFeatures": {
|
||||
"jsx": true
|
||||
}
|
||||
},
|
||||
"env": {
|
||||
"browser": true,
|
||||
@ -12,6 +15,7 @@
|
||||
"react"
|
||||
],
|
||||
"globals": {
|
||||
"Promise": true,
|
||||
"window": true,
|
||||
"$": true,
|
||||
"ga": true,
|
||||
@ -58,7 +62,6 @@
|
||||
"no-caller": 2,
|
||||
"no-div-regex": 2,
|
||||
"no-else-return": 0,
|
||||
"no-empty-label": 2,
|
||||
"no-eq-null": 1,
|
||||
"no-eval": 2,
|
||||
"no-extend-native": 2,
|
||||
@ -182,10 +185,7 @@
|
||||
"always"
|
||||
],
|
||||
"sort-vars": 0,
|
||||
"space-after-keywords": [
|
||||
2,
|
||||
"always"
|
||||
],
|
||||
"keyword-spacing": [ 2 ],
|
||||
"space-before-function-paren": [
|
||||
2,
|
||||
"never"
|
||||
@ -197,7 +197,6 @@
|
||||
"space-in-brackets": 0,
|
||||
"space-in-parens": 0,
|
||||
"space-infix-ops": 2,
|
||||
"space-return-throw-case": 2,
|
||||
"space-unary-ops": [
|
||||
1,
|
||||
{
|
||||
@ -214,7 +213,7 @@
|
||||
|
||||
"max-depth": 0,
|
||||
"max-len": [
|
||||
1,
|
||||
2,
|
||||
80,
|
||||
2
|
||||
],
|
||||
|
@ -34,6 +34,7 @@ window.common = (function(global) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
isAlive: function(key) {
|
||||
|
@ -51,10 +51,10 @@ $(document).ready(function() {
|
||||
<h1>${err}</h1>
|
||||
`).subscribe(() => {});
|
||||
}
|
||||
return null;
|
||||
},
|
||||
err => console.error(err)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
common.resetBtn$
|
||||
@ -74,6 +74,7 @@ $(document).ready(function() {
|
||||
common.codeStorage.updateStorage(challengeName, originalCode);
|
||||
common.codeUri.querify(originalCode);
|
||||
common.updateOutputDisplay(output);
|
||||
return null;
|
||||
},
|
||||
(err) => {
|
||||
if (err) {
|
||||
@ -112,6 +113,7 @@ $(document).ready(function() {
|
||||
if (solved) {
|
||||
common.showCompletion();
|
||||
}
|
||||
return null;
|
||||
},
|
||||
({ err }) => {
|
||||
console.error(err);
|
||||
@ -138,6 +140,7 @@ $(document).ready(function() {
|
||||
return common.updateOutputDisplay('' + err);
|
||||
}
|
||||
common.displayTestResults(tests);
|
||||
return null;
|
||||
},
|
||||
({ err }) => {
|
||||
console.error(err);
|
||||
@ -149,7 +152,7 @@ $(document).ready(function() {
|
||||
challengeType === challengeTypes.BONFIRE ||
|
||||
challengeType === challengeTypes.JS
|
||||
) {
|
||||
Observable.just({})
|
||||
return Observable.just({})
|
||||
.delay(500)
|
||||
.flatMap(() => common.executeChallenge$())
|
||||
.catch(err => Observable.just({ err }))
|
||||
@ -161,6 +164,7 @@ $(document).ready(function() {
|
||||
}
|
||||
common.codeStorage.updateStorage(challengeName, originalCode);
|
||||
common.displayTestResults(tests);
|
||||
return null;
|
||||
},
|
||||
(err) => {
|
||||
console.error(err);
|
||||
@ -168,4 +172,5 @@ $(document).ready(function() {
|
||||
}
|
||||
);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
@ -110,7 +110,7 @@ window.common = (function({ common = { init: [] }}) {
|
||||
return null;
|
||||
}
|
||||
execInProgress = true;
|
||||
setTimeout(function() {
|
||||
return setTimeout(function() {
|
||||
if (
|
||||
$($('.scroll-locker').children()[0]).height() - 800 > e.detail
|
||||
) {
|
||||
|
@ -92,16 +92,14 @@ window.common = (function({ $, common = { init: [] }}) {
|
||||
}
|
||||
|
||||
function handleActionClick(e) {
|
||||
var props = common.challengeSeed[0] ||
|
||||
{ stepIndex: [] };
|
||||
var props = common.challengeSeed[0] || { stepIndex: [] };
|
||||
|
||||
var $el = $(this);
|
||||
var index = +$el.attr('id');
|
||||
var propIndex = props.stepIndex.indexOf(index);
|
||||
|
||||
if (propIndex === -1) {
|
||||
return $el
|
||||
.parent()
|
||||
return $el.parent()
|
||||
.find('.disabled')
|
||||
.removeClass('disabled');
|
||||
}
|
||||
@ -112,24 +110,20 @@ window.common = (function({ $, common = { init: [] }}) {
|
||||
var prop = props.properties[propIndex];
|
||||
var api = props.apis[propIndex];
|
||||
if (common[prop]) {
|
||||
return $el
|
||||
.parent()
|
||||
return $el.parent()
|
||||
.find('.disabled')
|
||||
.removeClass('disabled');
|
||||
}
|
||||
$
|
||||
.post(api)
|
||||
return $.post(api)
|
||||
.done(function(data) {
|
||||
// assume a boolean indicates passing
|
||||
if (typeof data === 'boolean') {
|
||||
return $el
|
||||
.parent()
|
||||
return $el.parent()
|
||||
.find('.disabled')
|
||||
.removeClass('disabled');
|
||||
}
|
||||
// assume api returns string when fails
|
||||
$el
|
||||
.parent()
|
||||
return $el.parent()
|
||||
.find('.disabled')
|
||||
.replaceWith('<p>' + data + '</p>');
|
||||
})
|
||||
@ -199,6 +193,7 @@ window.common = (function({ $, common = { init: [] }}) {
|
||||
$(nextBtnClass).click(handleNextStepClick);
|
||||
$(actionBtnClass).click(handleActionClick);
|
||||
$(finishBtnClass).click(handleFinishClick);
|
||||
return null;
|
||||
});
|
||||
|
||||
return common;
|
||||
|
@ -93,6 +93,7 @@ main = (function(main, global) {
|
||||
'<span>Free Code Camp\'s Main Chat</span>' +
|
||||
'</div>'
|
||||
);
|
||||
return null;
|
||||
});
|
||||
|
||||
|
||||
@ -233,7 +234,7 @@ $(document).ready(function() {
|
||||
};
|
||||
|
||||
$('#story-submit').unbind('click');
|
||||
$.post('/stories/', data)
|
||||
return $.post('/stories/', data)
|
||||
.fail(function() {
|
||||
$('#story-submit').bind('click', storySubmitButtonHandler);
|
||||
})
|
||||
@ -243,6 +244,7 @@ $(document).ready(function() {
|
||||
return null;
|
||||
}
|
||||
window.location = '/stories/' + storyLink;
|
||||
return null;
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -4,15 +4,16 @@
|
||||
// errSaga(action: Action) => Object|Void
|
||||
export default () => ({ dispatch }) => next => {
|
||||
return function errorSaga(action) {
|
||||
if (!action.error) { return next(action); }
|
||||
const result = next(action);
|
||||
if (!action.error) { return result; }
|
||||
|
||||
console.error(action.error);
|
||||
dispatch({
|
||||
return dispatch({
|
||||
type: 'app.makeToast',
|
||||
payload: {
|
||||
type: 'error',
|
||||
title: 'Oops, something went wrong',
|
||||
message: `Something went wrong, please try again later`
|
||||
message: 'Something went wrong, please try again later'
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -103,6 +103,7 @@ class Question extends React.Component {
|
||||
.subscribe();
|
||||
|
||||
this._subscriptions.add(subscription);
|
||||
return null;
|
||||
}
|
||||
|
||||
handleMouseMove(isPressed, { delta, moveQuestion }) {
|
||||
|
@ -132,7 +132,7 @@ export class NewJob extends React.Component {
|
||||
if (certType === name) {
|
||||
return fields[certType].onChange(true);
|
||||
}
|
||||
fields[certType].onChange(false);
|
||||
return fields[certType].onChange(false);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,40 +0,0 @@
|
||||
import stamp from 'stampit';
|
||||
import { post$, postJSON$ } from '../utils/ajax-stream.js';
|
||||
|
||||
const serviceStamp = stamp({
|
||||
methods: {
|
||||
readService$(resource, params, config) {
|
||||
|
||||
return Observable.create(function(observer) {
|
||||
services.read(resource, params, config, (err, res) => {
|
||||
if (err) {
|
||||
return observer.onError(err);
|
||||
}
|
||||
|
||||
observer.onNext(res);
|
||||
observer.onCompleted();
|
||||
});
|
||||
|
||||
return Disposable.create(function() {
|
||||
observer.dispose();
|
||||
});
|
||||
});
|
||||
},
|
||||
createService$(resource, params, body, config) {
|
||||
return Observable.create(function(observer) {
|
||||
services.create(resource, params, body, config, (err, res) => {
|
||||
if (err) {
|
||||
return observer.onError(err);
|
||||
}
|
||||
|
||||
observer.onNext(res);
|
||||
observer.onCompleted();
|
||||
});
|
||||
|
||||
return Disposable.create(function() {
|
||||
observer.dispose();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
@ -105,7 +105,7 @@ export default function contain(options = {}, Component) {
|
||||
getChildContext(Component.contextTypes, this.context)
|
||||
);
|
||||
|
||||
professor.fetchContext.push({
|
||||
return professor.fetchContext.push({
|
||||
name: options.fetchAction,
|
||||
action,
|
||||
actionArgs,
|
||||
@ -136,7 +136,7 @@ export default function contain(options = {}, Component) {
|
||||
() => {},
|
||||
options.handleError
|
||||
);
|
||||
this.__subscriptions.add(subscription);
|
||||
return this.__subscriptions.add(subscription);
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps, nextContext) {
|
||||
|
@ -17,7 +17,7 @@ export function fetch({ fetchContext = [] }) {
|
||||
.doOnNext(fetch$ => {
|
||||
if (!Observable.isObservable(fetch$)) {
|
||||
throw new Error(
|
||||
`action creator should return an observable`
|
||||
'action creator should return an observable'
|
||||
);
|
||||
}
|
||||
})
|
||||
|
@ -73,7 +73,7 @@ export default function(UserIdent) {
|
||||
}
|
||||
);
|
||||
}
|
||||
cb(err, user, identity);
|
||||
return cb(err, user, identity);
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -99,12 +99,12 @@ export default function(UserIdent) {
|
||||
} else {
|
||||
query = { username: userObj.username };
|
||||
}
|
||||
userModel.findOrCreate({ where: query }, userObj, function(err, user) {
|
||||
return userModel.findOrCreate({ where: query }, userObj, (err, user) => {
|
||||
if (err) {
|
||||
return cb(err);
|
||||
}
|
||||
var date = new Date();
|
||||
userIdentityModel.create({
|
||||
return userIdentityModel.create({
|
||||
provider: getSocialProvider(provider),
|
||||
externalId: profile.id,
|
||||
authScheme: authScheme,
|
||||
@ -122,7 +122,7 @@ export default function(UserIdent) {
|
||||
}
|
||||
);
|
||||
}
|
||||
cb(err, user, identity);
|
||||
return cb(err, user, identity);
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -134,7 +134,7 @@ export default function(UserIdent) {
|
||||
debug('no user identity instance found');
|
||||
return next();
|
||||
}
|
||||
userIdent.user(function(err, user) {
|
||||
return userIdent.user(function(err, user) {
|
||||
let userChanged = false;
|
||||
if (err) { return next(err); }
|
||||
if (!user) {
|
||||
@ -175,11 +175,11 @@ export default function(UserIdent) {
|
||||
if (userChanged) {
|
||||
return user.save(function(err) {
|
||||
if (err) { return next(err); }
|
||||
next();
|
||||
return next();
|
||||
});
|
||||
}
|
||||
debug('exiting after user identity before save');
|
||||
next();
|
||||
return next();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ module.exports = function(User) {
|
||||
));
|
||||
});
|
||||
}
|
||||
User.findOne({ where: { username } }, (err, user) => {
|
||||
return User.findOne({ where: { username } }, (err, user) => {
|
||||
if (err) {
|
||||
return cb(err);
|
||||
}
|
||||
@ -327,7 +327,7 @@ module.exports = function(User) {
|
||||
.valueOf();
|
||||
const user$ = findUser({ where: { username: receiver }});
|
||||
|
||||
user$
|
||||
return user$
|
||||
.tapOnNext((user) => {
|
||||
if (!user) {
|
||||
throw new Error(`could not find receiver for ${ receiver }`);
|
||||
|
@ -9,7 +9,7 @@ function callbackObserver(observer) {
|
||||
}
|
||||
|
||||
observer.onNext(res);
|
||||
observer.onCompleted();
|
||||
return observer.onCompleted();
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@
|
||||
"emmet-codemirror": "^1.2.5",
|
||||
"errorhandler": "^1.4.2",
|
||||
"es6-map": "~0.1.1",
|
||||
"eslint": "~1.10.2",
|
||||
"eslint": "^2.2.0",
|
||||
"eslint-plugin-react": "^4.1.0",
|
||||
"express": "^4.13.3",
|
||||
"express-flash": "~0.0.2",
|
||||
@ -61,7 +61,7 @@
|
||||
"gulp": "^3.9.0",
|
||||
"gulp-babel": "^6.1.1",
|
||||
"gulp-concat": "^2.6.0",
|
||||
"gulp-eslint": "^1.1.0",
|
||||
"gulp-eslint": "^2.0.0",
|
||||
"gulp-jsonlint": "^1.1.0",
|
||||
"gulp-less": "^3.0.3",
|
||||
"gulp-nodemon": "^2.0.3",
|
||||
|
@ -21,7 +21,7 @@ module.exports = function(app) {
|
||||
if (!id) {
|
||||
return next();
|
||||
}
|
||||
Observable.combineLatest(
|
||||
return Observable.combineLatest(
|
||||
destroyAllRelated(id, UserIdentity),
|
||||
destroyAllRelated(id, UserCredential),
|
||||
function(identData, credData) {
|
||||
@ -30,7 +30,8 @@ module.exports = function(app) {
|
||||
credData: credData
|
||||
};
|
||||
}
|
||||
).subscribe(
|
||||
)
|
||||
.subscribe(
|
||||
function(data) {
|
||||
debug('deleted', data);
|
||||
},
|
||||
@ -82,15 +83,15 @@ module.exports = function(app) {
|
||||
};
|
||||
|
||||
debug('sending welcome email');
|
||||
Email.send(mailOptions, function(err) {
|
||||
return Email.send(mailOptions, function(err) {
|
||||
if (err) { return next(err); }
|
||||
req.logIn(user, function(err) {
|
||||
return req.logIn(user, function(err) {
|
||||
if (err) { return next(err); }
|
||||
|
||||
req.flash('success', {
|
||||
msg: [ "Welcome to Free Code Camp! We've created your account." ]
|
||||
});
|
||||
res.redirect(redirect);
|
||||
return res.redirect(redirect);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -120,6 +120,7 @@ function shouldShowNew(element, block) {
|
||||
}, 0);
|
||||
return newCount / block.length * 100 === 100;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// meant to be used with a filter method
|
||||
@ -516,7 +517,7 @@ module.exports = function(app) {
|
||||
if (data.id) {
|
||||
res.cookie('currentChallengeId', data.id);
|
||||
}
|
||||
res.render(view, data);
|
||||
return res.render(view, data);
|
||||
},
|
||||
next,
|
||||
function() {}
|
||||
@ -585,7 +586,7 @@ module.exports = function(app) {
|
||||
alreadyCompleted
|
||||
});
|
||||
}
|
||||
res.sendStatus(200);
|
||||
return res.sendStatus(200);
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -652,7 +653,7 @@ module.exports = function(app) {
|
||||
user.progressTimestamps.length + 1
|
||||
});
|
||||
}
|
||||
res.status(200).send(true);
|
||||
return res.status(200).send(true);
|
||||
})
|
||||
.subscribe(() => {}, next);
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ export default function commit(app) {
|
||||
})
|
||||
.subscribe(
|
||||
pledge => {
|
||||
let msg = `You have successfully stopped your pledge.`;
|
||||
let msg = 'You have successfully stopped your pledge.';
|
||||
if (!pledge) {
|
||||
msg = `No pledge found for user ${user.username}.`;
|
||||
}
|
||||
|
@ -14,9 +14,9 @@ module.exports = function(app) {
|
||||
return next();
|
||||
}
|
||||
req.user.picture = defaultProfileImage;
|
||||
req.user.save(function(err) {
|
||||
return req.user.save(function(err) {
|
||||
if (err) { return next(err); }
|
||||
next();
|
||||
return next();
|
||||
});
|
||||
}
|
||||
|
||||
@ -24,6 +24,6 @@ module.exports = function(app) {
|
||||
if (req.user) {
|
||||
return res.redirect('/challenges/current-challenge');
|
||||
}
|
||||
res.render('home', { title: message });
|
||||
return res.render('home', { title: message });
|
||||
}
|
||||
};
|
||||
|
@ -145,7 +145,7 @@ module.exports = function(app) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
process.nextTick(function() {
|
||||
return process.nextTick(function() {
|
||||
res.header('Content-Type', 'application/xml');
|
||||
res.render('resources/sitemap', {
|
||||
appUrl: appUrl,
|
||||
@ -227,14 +227,18 @@ module.exports = function(app) {
|
||||
}
|
||||
|
||||
function confirmStickers(req, res) {
|
||||
req.flash('success', { msg: 'Thank you for supporting our community! You should receive your stickers in the ' +
|
||||
'mail soon!'});
|
||||
req.flash('success', {
|
||||
msg: 'Thank you for supporting our community! You should receive ' +
|
||||
'your stickers in the mail soon!'
|
||||
});
|
||||
res.redirect('/shop');
|
||||
}
|
||||
|
||||
function cancelStickers(req, res) {
|
||||
req.flash('info', { msg: 'You\'ve cancelled your purchase of our stickers. You can '
|
||||
+ 'support our community any time by buying some.'});
|
||||
req.flash('info', {
|
||||
msg: 'You\'ve cancelled your purchase of our stickers. You can ' +
|
||||
'support our community any time by buying some.'
|
||||
});
|
||||
res.redirect('/shop');
|
||||
}
|
||||
function submitCatPhoto(req, res) {
|
||||
@ -280,18 +284,14 @@ module.exports = function(app) {
|
||||
function unsubscribe(req, res, next) {
|
||||
User.findOne({ where: { email: req.params.email } }, function(err, user) {
|
||||
if (user) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
if (err) { return next(err); }
|
||||
user.sendMonthlyEmail = false;
|
||||
user.save(function() {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
res.redirect('/unsubscribed');
|
||||
return user.save(function() {
|
||||
if (err) { return next(err); }
|
||||
return res.redirect('/unsubscribed');
|
||||
});
|
||||
} else {
|
||||
res.redirect('/unsubscribed');
|
||||
return res.redirect('/unsubscribed');
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -330,7 +330,7 @@ module.exports = function(app) {
|
||||
Object.keys(JSON.parse(pulls)).length :
|
||||
'Can\'t connect to github';
|
||||
|
||||
request(
|
||||
return request(
|
||||
[
|
||||
'https://api.github.com/repos/freecodecamp/',
|
||||
'freecodecamp/issues?client_id=',
|
||||
@ -344,7 +344,7 @@ module.exports = function(app) {
|
||||
issues = ((pulls === parseInt(pulls, 10)) && issues) ?
|
||||
Object.keys(JSON.parse(issues)).length - pulls :
|
||||
"Can't connect to GitHub";
|
||||
res.send({
|
||||
return res.send({
|
||||
issues: issues,
|
||||
pulls: pulls
|
||||
});
|
||||
@ -364,7 +364,7 @@ module.exports = function(app) {
|
||||
(JSON.parse(trello)) :
|
||||
'Can\'t connect to to Trello';
|
||||
|
||||
res.end(JSON.stringify(trello));
|
||||
return res.end(JSON.stringify(trello));
|
||||
});
|
||||
}
|
||||
|
||||
@ -379,7 +379,7 @@ module.exports = function(app) {
|
||||
blog = (status && status.statusCode === 200) ?
|
||||
JSON.parse(blog) :
|
||||
'Can\'t connect to Blogger';
|
||||
res.end(JSON.stringify(blog));
|
||||
return res.end(JSON.stringify(blog));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ module.exports = function(app) {
|
||||
return upvote.upVotedByUsername === username;
|
||||
});
|
||||
|
||||
res.render('stories/index', {
|
||||
return res.render('stories/index', {
|
||||
title: story.headline,
|
||||
link: story.link,
|
||||
originalStoryLink: dashedName,
|
||||
@ -357,7 +357,7 @@ module.exports = function(app) {
|
||||
url = 'http://' + url;
|
||||
}
|
||||
|
||||
findStory({ where: { link: url } })
|
||||
return findStory({ where: { link: url } })
|
||||
.map(function(stories) {
|
||||
if (stories.length) {
|
||||
return {
|
||||
|
@ -195,7 +195,7 @@ module.exports = function(app) {
|
||||
if (req.user) {
|
||||
return res.redirect('/');
|
||||
}
|
||||
res.render('account/signin', {
|
||||
return res.render('account/signin', {
|
||||
title: 'Sign in to Free Code Camp using a Social Media Account'
|
||||
});
|
||||
}
|
||||
@ -209,7 +209,7 @@ module.exports = function(app) {
|
||||
if (req.user) {
|
||||
return res.redirect('/');
|
||||
}
|
||||
res.render('account/email-signin', {
|
||||
return res.render('account/email-signin', {
|
||||
title: 'Sign in to Free Code Camp using your Email Address'
|
||||
});
|
||||
}
|
||||
@ -218,7 +218,7 @@ module.exports = function(app) {
|
||||
if (req.user) {
|
||||
return res.redirect('/');
|
||||
}
|
||||
res.render('account/email-signup', {
|
||||
return res.render('account/email-signup', {
|
||||
title: 'Sign up for Free Code Camp using your Email Address'
|
||||
});
|
||||
}
|
||||
@ -387,7 +387,7 @@ module.exports = function(app) {
|
||||
req.flash('errors', {
|
||||
msg: `Looks like user ${username} is not ${certText[certType]}`
|
||||
});
|
||||
res.redirect('back');
|
||||
return res.redirect('back');
|
||||
},
|
||||
next
|
||||
);
|
||||
@ -406,7 +406,7 @@ module.exports = function(app) {
|
||||
section at the bottom of this page.
|
||||
`
|
||||
});
|
||||
res.redirect('/' + req.user.username);
|
||||
return res.redirect('/' + req.user.username);
|
||||
});
|
||||
}
|
||||
req.user.isLocked = true;
|
||||
@ -420,7 +420,7 @@ module.exports = function(app) {
|
||||
section at the bottom of this page.
|
||||
`
|
||||
});
|
||||
res.redirect('/' + req.user.username);
|
||||
return res.redirect('/' + req.user.username);
|
||||
});
|
||||
}
|
||||
|
||||
@ -429,7 +429,7 @@ module.exports = function(app) {
|
||||
if (err) { return next(err); }
|
||||
req.logout();
|
||||
req.flash('info', { msg: 'Your account has been deleted.' });
|
||||
res.redirect('/');
|
||||
return res.redirect('/');
|
||||
});
|
||||
}
|
||||
|
||||
@ -438,7 +438,7 @@ module.exports = function(app) {
|
||||
req.flash('errors', { msg: 'access token invalid' });
|
||||
return res.render('account/forgot');
|
||||
}
|
||||
res.render('account/reset', {
|
||||
return res.render('account/reset', {
|
||||
title: 'Reset your Password',
|
||||
accessToken: req.accessToken.id
|
||||
});
|
||||
@ -453,14 +453,14 @@ module.exports = function(app) {
|
||||
return res.redirect('back');
|
||||
}
|
||||
|
||||
User.findById(req.accessToken.userId, function(err, user) {
|
||||
return User.findById(req.accessToken.userId, function(err, user) {
|
||||
if (err) { return next(err); }
|
||||
user.updateAttribute('password', password, function(err) {
|
||||
return user.updateAttribute('password', password, function(err) {
|
||||
if (err) { return next(err); }
|
||||
|
||||
debug('password reset processed successfully');
|
||||
req.flash('info', { msg: 'password reset processed successfully' });
|
||||
res.redirect('/');
|
||||
return res.redirect('/');
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -469,7 +469,7 @@ module.exports = function(app) {
|
||||
if (req.isAuthenticated()) {
|
||||
return res.redirect('/');
|
||||
}
|
||||
res.render('account/forgot', {
|
||||
return res.render('account/forgot', {
|
||||
title: 'Forgot Password'
|
||||
});
|
||||
}
|
||||
@ -483,7 +483,7 @@ module.exports = function(app) {
|
||||
return res.redirect('/forgot');
|
||||
}
|
||||
|
||||
User.resetPassword({
|
||||
return User.resetPassword({
|
||||
email: email
|
||||
}, function(err) {
|
||||
if (err) {
|
||||
@ -496,7 +496,7 @@ module.exports = function(app) {
|
||||
email +
|
||||
' with further instructions.'
|
||||
});
|
||||
res.render('account/forgot');
|
||||
return res.render('account/forgot');
|
||||
});
|
||||
}
|
||||
|
||||
@ -507,7 +507,7 @@ module.exports = function(app) {
|
||||
if (err) { return next(err); }
|
||||
|
||||
req.flash('success', { msg: 'Thanks for voting!' });
|
||||
res.redirect('/map');
|
||||
return res.redirect('/map');
|
||||
});
|
||||
} else {
|
||||
req.flash('error', { msg: 'You must be signed in to vote.' });
|
||||
@ -522,7 +522,7 @@ module.exports = function(app) {
|
||||
if (err) { return next(err); }
|
||||
|
||||
req.flash('success', { msg: 'Thanks for voting!' });
|
||||
res.redirect('/map');
|
||||
return res.redirect('/map');
|
||||
});
|
||||
} else {
|
||||
req.flash('error', {msg: 'You must be signed in to vote.'});
|
||||
|
@ -36,8 +36,9 @@ export default function addReturnToUrl() {
|
||||
) {
|
||||
return next();
|
||||
}
|
||||
req.session.returnTo = req.originalUrl === '/map-aside'
|
||||
? '/map' : req.originalUrl;
|
||||
next();
|
||||
req.session.returnTo = req.originalUrl === '/map-aside' ?
|
||||
'/map' :
|
||||
req.originalUrl;
|
||||
return next();
|
||||
};
|
||||
}
|
||||
|
@ -26,6 +26,6 @@ export default function({ globalPrepend = '' } = {}) {
|
||||
// in production we take use the initially loaded manifest
|
||||
// since this should not change in production
|
||||
res.locals.rev = boundRev;
|
||||
next();
|
||||
return next();
|
||||
};
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ export default function hikesService(app) {
|
||||
if (err) {
|
||||
return cb(err);
|
||||
}
|
||||
cb(null, hikes.map(hike => hike.toJSON()));
|
||||
return cb(null, hikes.map(hike => hike.toJSON()));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -22,7 +22,7 @@ export default function getJobServices(app) {
|
||||
isApproved: false
|
||||
});
|
||||
|
||||
Job.create(job, (err, savedJob) => {
|
||||
return Job.create(job, (err, savedJob) => {
|
||||
cb(err, savedJob.toJSON());
|
||||
});
|
||||
},
|
||||
@ -33,7 +33,7 @@ export default function getJobServices(app) {
|
||||
.then(job => cb(null, job.toJSON()))
|
||||
.catch(cb);
|
||||
}
|
||||
Job.find(whereFilt)
|
||||
return Job.find(whereFilt)
|
||||
.then(jobs => cb(null, jobs.map(job => job.toJSON())))
|
||||
.catch(cb);
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ module.exports = {
|
||||
|
||||
result.image = urlImage;
|
||||
result.description = description;
|
||||
callback(null, result);
|
||||
return callback(null, result);
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -10,13 +10,13 @@ export function saveInstance(instance) {
|
||||
observer.onNext();
|
||||
return observer.onCompleted();
|
||||
}
|
||||
instance.save(function(err, savedInstance) {
|
||||
return instance.save(function(err, savedInstance) {
|
||||
if (err) {
|
||||
return observer.onError(err);
|
||||
}
|
||||
debug('instance saved');
|
||||
observer.onNext(savedInstance);
|
||||
observer.onCompleted();
|
||||
return observer.onCompleted();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user