Fix indenting to 2 spaces, remove most lint errors
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user