@ -301,6 +301,10 @@ app.cacheBuster = null;
return app.alertError('[[error:not-logged-in]]');
}
if (parseInt(touid, 10) === parseInt(app.user.uid, 10)) {
return app.alertError('[[error:cant-chat-with-yourself]]');
socket.emit('modules.chats.newRoom', {touid: touid}, function (err, roomId) {
if (err) {
return app.alertError(err.message);
@ -41,7 +41,11 @@ define('forum/chats/search', ['components'], function (components) {
function displayResults(chatsListEl, data) {
chatsListEl.empty();
data.users = data.users.filter(function (user) {
return parseInt(user.uid, 10) !== parseInt(app.user.uid, 10);
});
if (!data.users.length) {
return chatsListEl.translateHtml('<li><div><span>[[users:no-users-found]]</span></div></li>');
@ -367,6 +367,10 @@ var userNotifications = require('./user/notifications');
return callback(new Error('[[error:chat-disabled]]'));
if (parseInt(uid, 10) === parseInt(toUid, 10)) {
return callback(new Error('[[error:cant-chat-with-yourself'));
async.waterfall([
function (next) {
user.exists(toUid, next);