From 39cf0476d36076ad3fcc039ce372ddfd0721f855 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Mon, 17 Jun 2013 15:46:13 -0400 Subject: [PATCH] follower and following count on account page --- public/templates/account.tpl | 9 +++++++++ src/routes/user.js | 12 ++++++++++-- src/user.js | 26 ++++++++++++++++++++------ 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/public/templates/account.tpl b/public/templates/account.tpl index a15b9aa9e4..a73da90c7b 100644 --- a/public/templates/account.tpl +++ b/public/templates/account.tpl @@ -56,6 +56,15 @@ posts {postcount}
+ + followers + {followerCount} +
+ + following + {followingCount} +
+
signature
diff --git a/src/routes/user.js b/src/routes/user.js index c657cf0592..c246bfd061 100644 --- a/src/routes/user.js +++ b/src/routes/user.js @@ -315,8 +315,16 @@ var user = require('./../user.js'), data.uid = uid; data.yourid = callerUID; data.theirid = uid; - - callback(data); + + user.getFollowingCount(uid, function(followingCount) { + user.getFollowerCount(uid, function(followerCount) { + data.followingCount = followingCount; + data.followerCount = followerCount; + + callback(data); + + }); + }); } else callback({}); diff --git a/src/user.js b/src/user.js index 7c1b716bce..f33a1832a3 100644 --- a/src/user.js +++ b/src/user.js @@ -34,7 +34,6 @@ var utils = require('./../public/src/utils.js'), }); } - // a function I feel should be built in user not sure how baris is tackling this so oppa chicken wrapper here User.getMultipleUserFields = function(uids, fields, callback) { if(uids.length === 0) { callback({}); @@ -48,7 +47,6 @@ var utils = require('./../public/src/utils.js'), var data = {}, loaded = 0; - for (var i=0, ii=uuids.length; i