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,
@ -144,7 +143,7 @@ exports.returnIndividualStory = function(req, res, next) {
try {
var votedObj = story.upVotes.filter(function(a) {
return a['upVotedByUsername'] === req.user['profile']['username'];
})
});
if (votedObj.length > 0) {
userVoted = true;
}
@ -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);
}