mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-03 12:36:02 +01:00
fix: #12923, inability to start chat with remote users via profile
This commit is contained in:
@@ -32,7 +32,7 @@ define('forum/account/header', [
|
||||
components.get('account/unfollow').on('click', () => toggleFollow('unfollow'));
|
||||
|
||||
components.get('account/chat').on('click', async function () {
|
||||
const { roomId } = await api.get(`/users/${ajaxify.data.uid}/chat`);
|
||||
const { roomId } = await api.get(`/users/${encodeURIComponent(ajaxify.data.uid)}/chat`);
|
||||
const chat = await app.require('chat');
|
||||
if (roomId) {
|
||||
chat.openChat(roomId);
|
||||
|
||||
@@ -64,6 +64,11 @@ define('chat', [
|
||||
return alerts.error('[[error:cant-chat-with-yourself]]');
|
||||
}
|
||||
|
||||
// Skip dnd check for remote users
|
||||
if (!utils.isNumber(touid)) {
|
||||
return createChat();
|
||||
}
|
||||
|
||||
api.get(`/users/${touid}/status`).then(({ status }) => {
|
||||
if (status !== 'dnd') {
|
||||
return createChat();
|
||||
|
||||
@@ -247,7 +247,9 @@ Messaging.generateUsernames = function (room, excludeUid) {
|
||||
|
||||
Messaging.generateChatWithMessage = async function (room, callerUid, userLang) {
|
||||
const users = room.users.filter(u => u && parseInt(u.uid, 10) !== callerUid);
|
||||
const usernames = users.map(u => `<a href="${relative_path}/uid/${u.uid}">${u.username}</a>`);
|
||||
const usernames = users.map(u => (utils.isNumber(u.uid) ?
|
||||
`<a href="${relative_path}/uid/${u.uid}">${u.username}</a>` :
|
||||
`<a href="${relative_path}/user/${u.username}">${u.username}</a>`));
|
||||
let compiled = '';
|
||||
if (!users.length) {
|
||||
return '[[modules:chat.no-users-in-room]]';
|
||||
|
||||
Reference in New Issue
Block a user