mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-05 18:47:03 +02:00
marathon bugfixing with @barisusakli re: #1788
This commit is contained in:
@@ -502,7 +502,9 @@ accountsController.getChats = function(req, res, next) {
|
||||
}
|
||||
|
||||
// Limit returned chats
|
||||
chats.length = 20;
|
||||
if (chats.length > 20) {
|
||||
chats.length = 20;
|
||||
}
|
||||
|
||||
res.render('chats', {
|
||||
meta: res.locals.chatData,
|
||||
|
||||
@@ -26,7 +26,7 @@ middleware.authenticate = function(req, res, next) {
|
||||
if (res.locals.isAPI) {
|
||||
return res.json(403, 'not-allowed');
|
||||
} else {
|
||||
return res.redirect('403');
|
||||
return res.redirect(nconf.get('url') + '/403');
|
||||
}
|
||||
} else {
|
||||
next();
|
||||
|
||||
@@ -182,10 +182,13 @@ SocketModules.chats.send = function(socket, data, callback) {
|
||||
|
||||
sendChatNotification(socket.uid, touid, message.fromUser.username, message);
|
||||
|
||||
// After-the-fact fixing of the "self" property for the message that goes to the receipient
|
||||
var recipMessage = JSON.parse(JSON.stringify(message));
|
||||
recipMessage.self = 0;
|
||||
server.getUserSockets(touid).forEach(function(s) {
|
||||
s.emit('event:chats.receive', {
|
||||
withUid: socket.uid,
|
||||
message: message
|
||||
message: recipMessage
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user