mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: #8297 guest handles shown in category.tpl
This commit is contained in:
@@ -120,7 +120,7 @@
|
||||
"change_owner_instruction": "Click the posts you want to assign to another user",
|
||||
|
||||
"composer.title_placeholder": "Enter your topic title here...",
|
||||
"composer.handle_placeholder": "Name",
|
||||
"composer.handle_placeholder": "Enter your name/handle here",
|
||||
"composer.discard": "Discard",
|
||||
"composer.submit": "Submit",
|
||||
"composer.replying_to": "Replying to %1",
|
||||
|
||||
@@ -69,7 +69,6 @@ Topics.getTopicsByTids = async function (tids, options) {
|
||||
|
||||
const [
|
||||
callerSettings,
|
||||
users,
|
||||
userSettings,
|
||||
categoriesData,
|
||||
hasRead,
|
||||
@@ -79,7 +78,6 @@ Topics.getTopicsByTids = async function (tids, options) {
|
||||
tags,
|
||||
] = await Promise.all([
|
||||
user.getSettings(uid),
|
||||
user.getUsersFields(uids, ['uid', 'username', 'fullname', 'userslug', 'reputation', 'postcount', 'picture', 'signature', 'banned', 'status']),
|
||||
user.getMultipleUserSettings(uids),
|
||||
categories.getCategoriesFields(cids, ['cid', 'name', 'slug', 'icon', 'image', 'imageClass', 'bgColor', 'color', 'disabled']),
|
||||
Topics.hasReadTopics(tids, uid),
|
||||
@@ -89,11 +87,21 @@ Topics.getTopicsByTids = async function (tids, options) {
|
||||
Topics.getTopicsTagsObjects(tids),
|
||||
]);
|
||||
|
||||
users.forEach(function (user, index) {
|
||||
if (meta.config.hideFullname || !userSettings[index].showfullname) {
|
||||
user.fullname = undefined;
|
||||
let users = await user.getUsersFields(uids, ['uid', 'username', 'fullname', 'userslug', 'reputation', 'postcount', 'picture', 'signature', 'banned', 'status']);
|
||||
users = await Promise.all(users.map(async (userObj, idx) => {
|
||||
// Retrieve guest handle from post
|
||||
if (userObj.uid === 0) {
|
||||
const handle = await posts.getPostField(topics[idx].mainPid, 'handle');
|
||||
userObj.username = handle;
|
||||
}
|
||||
});
|
||||
|
||||
// Hide fullname if needed
|
||||
if (meta.config.hideFullname || !userSettings[idx].showfullname) {
|
||||
userObj.fullname = undefined;
|
||||
}
|
||||
|
||||
return userObj;
|
||||
}));
|
||||
|
||||
const usersMap = _.zipObject(uids, users);
|
||||
const categoriesMap = _.zipObject(cids, categoriesData);
|
||||
|
||||
Reference in New Issue
Block a user