added some user friendly warnings to chat

This commit is contained in:
psychobunny
2013-11-21 17:00:20 -05:00
parent 22a3794c51
commit da8d198676
2 changed files with 22 additions and 3 deletions

View File

@@ -331,6 +331,28 @@ var socket,
}
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) {
var chatModal;
if (!chat.modalExists(touid)) {

View File

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