mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-13 17:35:46 +01:00
closes #619
This commit is contained in:
@@ -696,9 +696,15 @@ websockets.init = function(io) {
|
|||||||
|
|
||||||
var msg = utils.strip_tags(data.message);
|
var msg = utils.strip_tags(data.message);
|
||||||
|
|
||||||
user.getUserField(uid, 'username', function(err, username) {
|
user.getMultipleUserFields([uid, touid], ['username'], function(err, usersData) {
|
||||||
|
if(err) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var finalMessage = username + ' : ' + msg,
|
var finalMessage = username + ' : ' + msg,
|
||||||
notifText = 'New message from <strong>' + username + '</strong>';
|
notifText = 'New message from <strong>' + username + '</strong>',
|
||||||
|
username = usersData[0].username,
|
||||||
|
toUsername = usersData[1].username;
|
||||||
|
|
||||||
if (!isUserOnline(touid)) {
|
if (!isUserOnline(touid)) {
|
||||||
notifications.create(notifText, 'javascript:app.openChat('' + username + '', ' + uid + ');', 'notification_' + uid + '_' + touid, function(nid) {
|
notifications.create(notifText, 'javascript:app.openChat('' + username + '', ' + uid + ');', 'notification_' + uid + '_' + touid, function(nid) {
|
||||||
@@ -731,7 +737,7 @@ websockets.init = function(io) {
|
|||||||
for (var x = 0; x < numSockets; ++x) {
|
for (var x = 0; x < numSockets; ++x) {
|
||||||
userSockets[uid][x].emit('event:chats.receive', {
|
userSockets[uid][x].emit('event:chats.receive', {
|
||||||
fromuid: touid,
|
fromuid: touid,
|
||||||
username: username,
|
username: toUsername,
|
||||||
message: 'You : ' + msg,
|
message: 'You : ' + msg,
|
||||||
timestamp: Date.now()
|
timestamp: Date.now()
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user