crash fix if topic has no posts, and check confirm obj

v1.18.x
Baris Soner Usakli 11 years ago
parent 31a57cf0dd
commit c18788fbc9

@ -38,13 +38,17 @@
}
}
var description = topicData.posts.length ? topicData.posts[0].content : '';
var image_url = topicData.posts.length ? topicData.posts[0].picture : '';
var author = topicData.posts.length ? topicData.posts[0].username : '';
var feed = new rss({
title: topicData.topic_name,
description: topicData.posts[0].content,
description: description,
feed_url: Feed.defaults.baseUrl + '/topics/' + tid + '.rss',
site_url: nconf.get('url') + '/topic/' + topicData.slug,
image_url: topicData.posts[0].picture,
author: topicData.posts[0].username,
image_url: image_url,
author: author,
ttl: Feed.defaults.ttl
}),
dateStamp;

@ -926,21 +926,21 @@ var bcrypt = require('bcryptjs'),
confirm: function(code, callback) {
db.getObject('confirm:' + code, function(err, confirmObj) {
if (err) {
callback({
return callback({
status:'error'
});
} else {
if (confirmObj.uid && confirmObj.email) {
db.setObjectField('email:confirmed', confirmObj.email, '1', function() {
callback({
status: 'ok'
});
});
} else {
}
if (confirmObj && confirmObj.uid && confirmObj.email) {
db.setObjectField('email:confirmed', confirmObj.email, '1', function() {
callback({
status: 'not_ok'
status: 'ok'
});
}
});
} else {
callback({
status: 'not_ok'
});
}
});
}

Loading…
Cancel
Save