mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +01:00
follower count fix
This commit is contained in:
@@ -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();
|
||||
|
25
src/user.js
25
src/user.js
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user