|
|
@ -320,11 +320,13 @@ var db = require('./database'),
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
function sendNotifications(fromuid, touid, messageObj, callback) {
|
|
|
|
function sendNotifications(fromuid, touid, messageObj, callback) {
|
|
|
|
if (!websockets.isUserOnline(touid)) {
|
|
|
|
if (websockets.isUserOnline(touid)) {
|
|
|
|
|
|
|
|
return callback();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
notifications.create({
|
|
|
|
notifications.create({
|
|
|
|
bodyShort: '[[notifications:new_message_from, ' + messageObj.fromUser.username + ']]',
|
|
|
|
bodyShort: '[[notifications:new_message_from, ' + messageObj.fromUser.username + ']]',
|
|
|
|
bodyLong: messageObj.content,
|
|
|
|
bodyLong: messageObj.content,
|
|
|
|
path: nconf.get('relative_path') + '/chats/' + utils.slugify(messageObj.fromUser.username),
|
|
|
|
|
|
|
|
nid: 'chat_' + fromuid + '_' + touid,
|
|
|
|
nid: 'chat_' + fromuid + '_' + touid,
|
|
|
|
from: fromuid
|
|
|
|
from: fromuid
|
|
|
|
}, function(err, notification) {
|
|
|
|
}, function(err, notification) {
|
|
|
@ -347,6 +349,5 @@ var db = require('./database'),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}(exports));
|
|
|
|
}(exports));
|
|
|
|