follower count fix

v1.18.x
Baris Usakli 11 years ago
parent 8e4ca8e474
commit 9af26db57a

@ -17,7 +17,7 @@ define(['forum/accountheader'], function(header) {
var followBtn = $('#follow-btn');
var unfollowBtn = $('#unfollow-btn');
if (yourid !== theirid) {
if (yourid !== theirid && yourid !== "0") {
if (isFollowing) {
followBtn.hide();
unfollowBtn.show();

@ -529,24 +529,26 @@ var utils = require('./../public/src/utils.js'),
User.getFollowingCount = function(uid, callback) {
RDB.smembers('following:' + uid, function(err, userIds) {
if (!err) {
callback(userIds.length);
} else {
if (err) {
console.log(err);
} else {
userIds = userIds.filter(function(value) {
return value === '0';
});
callback(userIds.length);
}
});
}
User.getFollowerCount = function(uid, callback) {
RDB.smembers('followers:' + uid, function(err, userIds) {
// @note why are error-handling styles being mixed?
// either go with not-error-dosomething-else-dosomethingelse, or
// go with if-error-dosomething-return
// also why is console.log(err) being used when below we're using RDB.handle()?
if (!err) {
callback(userIds.length);
} else {
if(err) {
console.log(err);
} else {
userIds = userIds.filter(function(value) {
return value === '0';
});
callback(userIds.length);
}
});
}
@ -560,6 +562,9 @@ var utils = require('./../public/src/utils.js'),
}
function iterator(uid, callback) {
if(uid === "0")
return callback(null);
User.getUserData(uid, function(err, userData) {
returnData.push(userData);

Loading…
Cancel
Save