mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
fix: #8077, show continue chat on all profile pages
This commit is contained in:
@@ -11,6 +11,7 @@ const meta = require('../../meta');
|
||||
const utils = require('../../utils');
|
||||
const privileges = require('../../privileges');
|
||||
const translator = require('../../translator');
|
||||
const messaging = require('../../messaging');
|
||||
|
||||
const helpers = module.exports;
|
||||
|
||||
@@ -75,6 +76,7 @@ helpers.getUserDataByUserSlug = async function (userslug, callerUID) {
|
||||
userData.canChangePassword = isAdmin || (isSelf && !meta.config['password:disableEdit']);
|
||||
userData.isSelf = isSelf;
|
||||
userData.isFollowing = results.isFollowing;
|
||||
userData.hasPrivateChat = results.hasPrivateChat;
|
||||
userData.showHidden = isSelf || isAdmin || (isGlobalModerator && !results.isTargetAdmin);
|
||||
userData.groups = Array.isArray(results.groups) && results.groups.length ? results.groups[0] : [];
|
||||
userData.disableSignatures = meta.config.disableSignatures === 1;
|
||||
@@ -132,6 +134,7 @@ async function getAllData(uid, callerUID) {
|
||||
canBanUser: privileges.users.canBanUser(callerUID, uid),
|
||||
isBlocked: user.blocks.is(uid, callerUID),
|
||||
canViewInfo: privileges.global.can('view:users:info', callerUID),
|
||||
hasPrivateChat: messaging.hasPrivateChat(callerUID, uid),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ const plugins = require('../../plugins');
|
||||
const meta = require('../../meta');
|
||||
const accountHelpers = require('./helpers');
|
||||
const helpers = require('../helpers');
|
||||
const messaging = require('../../messaging');
|
||||
const utils = require('../../utils');
|
||||
|
||||
const profileController = module.exports;
|
||||
@@ -33,8 +32,7 @@ profileController.get = async function (req, res, next) {
|
||||
|
||||
await incrementProfileViews(req, userData);
|
||||
|
||||
const [hasPrivateChat, latestPosts, bestPosts] = await Promise.all([
|
||||
messaging.hasPrivateChat(req.uid, userData.uid),
|
||||
const [latestPosts, bestPosts] = await Promise.all([
|
||||
getLatestPosts(req.uid, userData),
|
||||
getBestPosts(req.uid, userData),
|
||||
posts.parseSignature(userData, req.uid),
|
||||
@@ -47,7 +45,6 @@ profileController.get = async function (req, res, next) {
|
||||
userData.posts = latestPosts; // for backwards compat.
|
||||
userData.latestPosts = latestPosts;
|
||||
userData.bestPosts = bestPosts;
|
||||
userData.hasPrivateChat = hasPrivateChat;
|
||||
userData.breadcrumbs = helpers.buildBreadcrumbs([{ text: userData.username }]);
|
||||
userData.title = userData.username;
|
||||
userData.allowCoverPicture = !userData.isSelf || !!meta.config['reputation:disabled'] || userData.reputation >= meta.config['min:rep:cover-picture'];
|
||||
|
||||
Reference in New Issue
Block a user