mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 03:26:04 +01:00
follower count fix
This commit is contained in:
@@ -17,7 +17,7 @@ define(['forum/accountheader'], function(header) {
|
|||||||
var followBtn = $('#follow-btn');
|
var followBtn = $('#follow-btn');
|
||||||
var unfollowBtn = $('#unfollow-btn');
|
var unfollowBtn = $('#unfollow-btn');
|
||||||
|
|
||||||
if (yourid !== theirid) {
|
if (yourid !== theirid && yourid !== "0") {
|
||||||
if (isFollowing) {
|
if (isFollowing) {
|
||||||
followBtn.hide();
|
followBtn.hide();
|
||||||
unfollowBtn.show();
|
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) {
|
User.getFollowingCount = function(uid, callback) {
|
||||||
RDB.smembers('following:' + uid, function(err, userIds) {
|
RDB.smembers('following:' + uid, function(err, userIds) {
|
||||||
if (!err) {
|
if (err) {
|
||||||
callback(userIds.length);
|
|
||||||
} else {
|
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
} else {
|
||||||
|
userIds = userIds.filter(function(value) {
|
||||||
|
return value === '0';
|
||||||
|
});
|
||||||
|
callback(userIds.length);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
User.getFollowerCount = function(uid, callback) {
|
User.getFollowerCount = function(uid, callback) {
|
||||||
RDB.smembers('followers:' + uid, function(err, userIds) {
|
RDB.smembers('followers:' + uid, function(err, userIds) {
|
||||||
// @note why are error-handling styles being mixed?
|
if(err) {
|
||||||
// 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 {
|
|
||||||
console.log(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) {
|
function iterator(uid, callback) {
|
||||||
|
if(uid === "0")
|
||||||
|
return callback(null);
|
||||||
|
|
||||||
User.getUserData(uid, function(err, userData) {
|
User.getUserData(uid, function(err, userData) {
|
||||||
returnData.push(userData);
|
returnData.push(userData);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user