From 1abfe5de634ba52ac8fbd1aed64af595c124cb0f Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Thu, 12 Dec 2013 12:17:58 -0500 Subject: [PATCH] added err to addUserInfoToPost --- src/posts.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/posts.js b/src/posts.js index fd250d5b38..dcb53d6379 100644 --- a/src/posts.js +++ b/src/posts.js @@ -14,7 +14,8 @@ var db = require('./database'), async = require('async'), nconf = require('nconf'), validator = require('validator'), - winston = require('winston'); + winston = require('winston'), + gravatar = require('gravatar'); (function(Posts) { var customUserInfo = {}; @@ -202,12 +203,16 @@ var db = require('./database'), } postTools.parseSignature(userData.signature, function(err, signature) { + if(err) { + return callback(err); + } + post.username = userData.username || 'anonymous'; post.userslug = userData.userslug || ''; post.user_rep = userData.reputation || 0; post.user_postcount = userData.postcount || 0; post.user_banned = parseInt(userData.banned, 10) === 1; - post.picture = userData.picture || require('gravatar').url('', {}, https = nconf.get('https')); + post.picture = userData.picture || gravatar.url('', {}, https = nconf.get('https')); post.signature = signature; for (var info in customUserInfo) { @@ -217,11 +222,16 @@ var db = require('./database'), } plugins.fireHook('filter:posts.custom_profile_info', {profile: "", uid: post.uid, pid: post.pid}, function(err, profile_info) { + if(err) { + return callback(err); + } post.additional_profile_info = profile_info.profile; if (post.editor !== '') { user.getUserFields(post.editor, ['username', 'userslug'], function(err, editorData) { - if (err) return callback(); + if (err) { + return callback(); + } post.editorname = editorData.username; post.editorslug = editorData.userslug;