mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 15:05:46 +01:00
closes #3930
This commit is contained in:
@@ -27,6 +27,11 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',
|
|||||||
Chats.scrollToBottom($('.expanded-chat ul'));
|
Chats.scrollToBottom($('.expanded-chat ul'));
|
||||||
|
|
||||||
Chats.initialised = true;
|
Chats.initialised = true;
|
||||||
|
|
||||||
|
if (ajaxify.data.hasOwnProperty('meta') && ajaxify.data.meta.hasOwnProperty('uid')) {
|
||||||
|
// This is an active chat, focus on the input box
|
||||||
|
components.get('chat/input').focus();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Chats.getRecipientUid = function() {
|
Chats.getRecipientUid = function() {
|
||||||
@@ -93,8 +98,6 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',
|
|||||||
if (prev.length) {
|
if (prev.length) {
|
||||||
Chats.switchChat(parseInt(prev.attr('data-uid'), 10), prev.attr('data-username'));
|
Chats.switchChat(parseInt(prev.attr('data-uid'), 10), prev.attr('data-username'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$('[component="chat/input"]').focus();
|
|
||||||
});
|
});
|
||||||
Mousetrap.bind('ctrl+down', function() {
|
Mousetrap.bind('ctrl+down', function() {
|
||||||
var activeContact = $('.chats-list .bg-primary'),
|
var activeContact = $('.chats-list .bg-primary'),
|
||||||
@@ -103,8 +106,6 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',
|
|||||||
if (next.length) {
|
if (next.length) {
|
||||||
Chats.switchChat(parseInt(next.attr('data-uid'), 10), next.attr('data-username'));
|
Chats.switchChat(parseInt(next.attr('data-uid'), 10), next.attr('data-username'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$('[component="chat/input"]').focus();
|
|
||||||
});
|
});
|
||||||
Mousetrap.bind('up', function(e) {
|
Mousetrap.bind('up', function(e) {
|
||||||
if (e.target === components.get('chat/input').get(0)) {
|
if (e.target === components.get('chat/input').get(0)) {
|
||||||
@@ -195,11 +196,12 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',
|
|||||||
var contactEl = $('.chats-list [data-uid="' + uid + '"]');
|
var contactEl = $('.chats-list [data-uid="' + uid + '"]');
|
||||||
|
|
||||||
Chats.loadChatSince(uid, $('.chat-content'), 'recent');
|
Chats.loadChatSince(uid, $('.chat-content'), 'recent');
|
||||||
Chats.addSendHandlers(uid, $('[component="chat/input"]'), $('[data-action="send"]'));
|
Chats.addSendHandlers(uid, components.get('chat/input'), $('[data-action="send"]'));
|
||||||
contactEl.addClass('bg-primary').siblings().removeClass('bg-primary');
|
contactEl.addClass('bg-primary').siblings().removeClass('bg-primary');
|
||||||
$('[component="chat/title"]').text(username);
|
components.get('chat/title').text(username);
|
||||||
$('[component="chat/messages"]').attr('data-uid', uid).attr('data-username', username);
|
components.get('chat/messages').attr('data-uid', uid).attr('data-username', username);
|
||||||
$('[component="breadcrumb/current"]').text(username);
|
components.get('breadcrumb/current').text(username);
|
||||||
|
components.get('chat/input').focus();
|
||||||
|
|
||||||
if (window.history && window.history.pushState) {
|
if (window.history && window.history.pushState) {
|
||||||
var url = 'chats/' + utils.slugify(username);
|
var url = 'chats/' + utils.slugify(username);
|
||||||
|
|||||||
Reference in New Issue
Block a user