mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 17:16:14 +01:00
first pass #1720, updating existing calls to notifications.create, backwards compatibility in case plugins create notifications too.
This commit is contained in:
@@ -186,7 +186,7 @@ SocketModules.chats.send = function(socket, data, callback) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
sendChatNotification(socket.uid, touid, message.fromUser.username);
|
||||
sendChatNotification(socket.uid, touid, message.fromUser.username, message);
|
||||
|
||||
server.getUserSockets(touid).forEach(function(s) {
|
||||
s.emit('event:chats.receive', {
|
||||
@@ -204,11 +204,14 @@ SocketModules.chats.send = function(socket, data, callback) {
|
||||
});
|
||||
};
|
||||
|
||||
function sendChatNotification(fromuid, touid, username) {
|
||||
function sendChatNotification(fromuid, touid, username, message) {
|
||||
if (!module.parent.exports.isUserOnline(touid)) {
|
||||
var notifText = '[[notifications:new_message_from, ' + username + ']]';
|
||||
notifications.create({
|
||||
text: notifText,
|
||||
body: {
|
||||
short: notifText,
|
||||
long: message
|
||||
},
|
||||
path: 'javascript:app.openChat('' + username + '', ' + fromuid + ');',
|
||||
uniqueId: 'notification_' + fromuid + '_' + touid,
|
||||
from: fromuid
|
||||
|
||||
Reference in New Issue
Block a user