mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-06-23 01:00:21 +02: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/unfollow').on('click', () => toggleFollow('unfollow'));
|
||||||
|
|
||||||
components.get('account/chat').on('click', async function () {
|
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');
|
const chat = await app.require('chat');
|
||||||
if (roomId) {
|
if (roomId) {
|
||||||
chat.openChat(roomId);
|
chat.openChat(roomId);
|
||||||
|
|||||||
@@ -64,6 +64,11 @@ define('chat', [
|
|||||||
return alerts.error('[[error:cant-chat-with-yourself]]');
|
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 }) => {
|
api.get(`/users/${touid}/status`).then(({ status }) => {
|
||||||
if (status !== 'dnd') {
|
if (status !== 'dnd') {
|
||||||
return createChat();
|
return createChat();
|
||||||
|
|||||||
@@ -247,7 +247,9 @@ Messaging.generateUsernames = function (room, excludeUid) {
|
|||||||
|
|
||||||
Messaging.generateChatWithMessage = async function (room, callerUid, userLang) {
|
Messaging.generateChatWithMessage = async function (room, callerUid, userLang) {
|
||||||
const users = room.users.filter(u => u && parseInt(u.uid, 10) !== callerUid);
|
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 = '';
|
let compiled = '';
|
||||||
if (!users.length) {
|
if (!users.length) {
|
||||||
return '[[modules:chat.no-users-in-room]]';
|
return '[[modules:chat.no-users-in-room]]';
|
||||||
|
|||||||
Reference in New Issue
Block a user