Skip to content

Node.js based forum software built for the modern web

fix: only add blocksCount for self and admins

Barış Soner Uşaklı59a2ace6f7b0
diff --git a/src/controllers/accounts/helpers.js b/src/controllers/accounts/helpers.js
index 6686f17cfd..817de9dd01 100644
--- a/src/controllers/accounts/helpers.js
+++ b/src/controllers/accounts/helpers.js
@@ -59,7 +59,7 @@ helpers.getUserDataByUserSlug = async function (userslug, callerUID) {
userData.isBlocked = results.isBlocked;
if (isAdmin || isSelf) {
- userData.blocksCount = parseInt(userData.blocksCount, 10) || 0;
+ userData.blocksCount = await user.getUserField(userData.uid, 'blocksCount');
}
userData.yourid = callerUID;
diff --git a/src/controllers/user.js b/src/controllers/user.js
index b0e79669a4..6d197f3239 100644
--- a/src/controllers/user.js
+++ b/src/controllers/user.js
@@ -72,7 +72,6 @@ userController.getUserDataByUID = async function (callerUid, uid) {
userData.email = settings.showemail && !meta.config.hideEmail ? userData.email : undefined;
userData.fullname = settings.showfullname && !meta.config.hideFullname ? userData.fullname : undefined;
- userData.blocksCount = undefined;
return userData;
};
diff --git a/src/user/data.js b/src/user/data.js
index ef48266b17..1f9a8e9dd7 100644
--- a/src/user/data.js
+++ b/src/user/data.js
@@ -28,8 +28,8 @@ module.exports = function (User) {
'lastonline', 'picture', 'fullname', 'location', 'birthday', 'website',
'aboutme', 'signature', 'uploadedpicture', 'profileviews', 'reputation',
'postcount', 'topiccount', 'lastposttime', 'banned', 'banned:expire',
- 'status', 'flags', 'followerCount', 'followingCount', 'blocksCount',
- 'cover:url', 'cover:position', 'groupTitle',
+ 'status', 'flags', 'followerCount', 'followingCount', 'cover:url',
+ 'cover:position', 'groupTitle',
];
User.guestData = {