fixed crash bug if user was logged off
This commit is contained in:
@ -137,15 +137,18 @@ exports.returnIndividualStory = function(req, res, next) {
|
|||||||
return res.redirect('../stories/' + dashedNameFull);
|
return res.redirect('../stories/' + dashedNameFull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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'];
|
return a['upVotedByUsername'] === req.user['profile']['username'];
|
||||||
})
|
})
|
||||||
var userVoted = false;
|
|
||||||
if (votedObj.length > 0){
|
if (votedObj.length > 0){
|
||||||
userVoted = true;
|
userVoted = true;
|
||||||
}
|
}
|
||||||
|
} catch(err){
|
||||||
|
userVoted = false;
|
||||||
|
}
|
||||||
res.render('stories/index', {
|
res.render('stories/index', {
|
||||||
title: story.headline,
|
title: story.headline,
|
||||||
link: story.link,
|
link: story.link,
|
||||||
|
Reference in New Issue
Block a user