This commit is contained in:
Barış Soner Uşaklı
2016-10-22 10:22:05 +03:00
parent f2275ca261
commit cbd936c547
3 changed files with 13 additions and 1 deletions

View File

@@ -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);

View File

@@ -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>');
}

View File

@@ -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);