Fix indenting to 2 spaces, remove most lint errors

This commit is contained in:
Nathan Leniz
2015-03-22 20:20:08 +09:00
parent fb5e8dc387
commit 999ba14db7

View File

@ -28,8 +28,7 @@ exports.hotJSON = function(req, res) {
var story = Story.find({}).sort({'timePosted': -1}).limit(1000);
story.exec(function(err, stories) {
if (err) {
res.send(500);
return next(err);
return res.status(500);
}
var foundationDate = 1413298800000;
@ -105,7 +104,7 @@ exports.preSubmit = function(req, res) {
var image = data.image || '';
var description = data.description || '';
return res.render('stories/index', {
title: "Confirm your Camper News story submission",
title: 'Confirm your Camper News story submission',
page: 'storySubmission',
storyURL: data.url,
storyTitle: title,
@ -120,7 +119,7 @@ exports.returnIndividualStory = function(req, res, next) {
var storyName = dashedName.replace(/\-/g, ' ');
Story.find({'storyLink' : new RegExp(storyName, 'i')}, function(err, story) {
Story.find({'storyLink': new RegExp(storyName, 'i')}, function(err, story) {
if (err) {
next(err);
}
@ -142,13 +141,13 @@ exports.returnIndividualStory = function(req, res, next) {
var userVoted = false;
try {
var votedObj = story.upVotes.filter(function(a){
var votedObj = story.upVotes.filter(function(a) {
return a['upVotedByUsername'] === req.user['profile']['username'];
})
if (votedObj.length > 0){
});
if (votedObj.length > 0) {
userVoted = true;
}
} catch(err){
} catch(err) {
userVoted = false;
}
res.render('stories/index', {
@ -171,9 +170,12 @@ exports.returnIndividualStory = function(req, res, next) {
exports.getStories = function(req, res) {
MongoClient.connect(secrets.db, function(err, database) {
if (err) {
return res.status(500);
}
database.collection('stories').find({
"$text": {
"$search": req.body.data.searchValue
'$text': {
'$search': req.body.data.searchValue
}
}, {
headline: 1,
@ -188,15 +190,18 @@ exports.getStories = function(req, res) {
storyLink: 1,
metaDescription: 1,
textScore: {
$meta: "textScore"
$meta: 'textScore'
}
}, {
sort: {
textScore: {
$meta: "textScore"
$meta: 'textScore'
}
}
}).toArray(function(err, items) {
if (err) {
return res.status(500);
}
if (items !== null && items.length !== 0) {
return res.json(items);
}