added some user friendly warnings to chat

v1.18.x
psychobunny 11 years ago
parent 22a3794c51
commit da8d198676

@ -331,6 +331,28 @@ var socket,
} }
app.openChat = function (username, touid) { app.openChat = function (username, touid) {
if (username === app.username) {
app.alert({
type: 'warning',
title: 'Invalid Chat',
message: "You can't chat with yourself!",
timeout: 5000
});
return;
}
if (!app.username) {
app.alert({
type: 'danger',
title: 'Not Logged In',
message: 'Please log in to chat with <strong>' + username + '</strong>',
timeout: 5000
});
return;
}
require(['chat'], function (chat) { require(['chat'], function (chat) {
var chatModal; var chatModal;
if (!chat.modalExists(touid)) { if (!chat.modalExists(touid)) {

@ -362,9 +362,6 @@ define(function() {
var username = $(this).parents('li.row').attr('data-username'); var username = $(this).parents('li.row').attr('data-username');
var touid = $(this).parents('li.row').attr('data-uid'); var touid = $(this).parents('li.row').attr('data-uid');
if (username === app.username || !app.username)
return;
app.openChat(username, touid); app.openChat(username, touid);
}); });

Loading…
Cancel
Save