diff options
| author | Jules Laplace <jules@okfoc.us> | 2014-12-10 14:21:24 -0500 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2014-12-10 14:21:24 -0500 |
| commit | f9ece85045a9766ff6381ed26ef663aa718f2bca (patch) | |
| tree | 64fbceecb5c0826aa2d30cd496c4b9971d3b9204 /server/lib | |
| parent | 188f63d9315499e46633a94eb42f108556b94414 (diff) | |
| parent | f7475059dadf25161471e8b3086d127a1d1545f9 (diff) | |
merge
Diffstat (limited to 'server/lib')
| -rw-r--r-- | server/lib/views/index.js | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/server/lib/views/index.js b/server/lib/views/index.js index 6ceef7e..8c3e63d 100644 --- a/server/lib/views/index.js +++ b/server/lib/views/index.js @@ -171,15 +171,20 @@ var views = module.exports = { if ( ! isOwnProfile ) { criteria.privacy = false } - views_middleware.fetchProjects(criteria, null, null, done) + views_middleware.fetchProjects(criteria, null, null, function(err, projects){ + views_middleware.fetchUserProjectCount(criteria, function(projectCount){ + done(err, projects, projectCount) + }) + }) } - function done(err, projects){ + function done(err, projects, projectCount){ if (! user) { return res.redirect('/') } res.render('profile', { isOwnProfile: isOwnProfile, profile: user, projects: projects || [], + projectCount: projectCount, ogTitle: "VValls: Profile of " + user.displayName, ogUrl: "http://vvalls.com/profile/" + user.username + "/", ogImage: user.photo, @@ -240,5 +245,10 @@ var views_middleware = { }) next(err, projects) }) - } + }, + fetchUserProjectCount: function(criteria, next){ + Project.count(criteria, function(err, count){ + next(count || 0) + }) + }, } |
