mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 22:45:46 +01:00
added some user friendly warnings to chat
This commit is contained in:
@@ -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);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user