Skip to content

Node.js based forum software built for the modern web

removed notify typing code, not even working

barisusakli8bc80abde6f4
diff --git a/public/src/client/chats.js b/public/src/client/chats.js
index 2df0601dd3..21da307713 100644
--- a/public/src/client/chats.js
+++ b/public/src/client/chats.js
@@ -204,7 +204,6 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',
return;
}
- Chats.notifyTyping(roomId, val);
$(this).attr('data-typing', val);
});
@@ -370,14 +369,6 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',
}
});
- socket.on('event:chats.userStartTyping', function(withUid) {
- $('.chats-list li[data-uid="' + withUid + '"]').addClass('typing');
- });
-
- socket.on('event:chats.userStopTyping', function(withUid) {
- $('.chats-list li[data-uid="' + withUid + '"]').removeClass('typing');
- });
-
socket.on('event:user_status_change', function(data) {
app.updateUserStatus($('.chats-list [data-uid="' + data.uid + '"] [component="user/status"]'), data.status);
});
@@ -423,13 +414,6 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',
Chats.setActive();
};
- Chats.notifyTyping = function(roomId, typing) {
- socket.emit('modules.chats.user' + (typing ? 'Start' : 'Stop') + 'Typing', {
- roomId: roomId,
- fromUid: app.user.uid
- });
- };
-
Chats.sendMessage = function(roomId, inputEl) {
var msg = inputEl.val();
var mid = inputEl.attr('data-mid');
@@ -458,7 +442,6 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',
}
sounds.play('chat-outgoing');
- Chats.notifyTyping(roomId, false);
});
} else {
socket.emit('modules.chats.edit', {
@@ -470,7 +453,6 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',
return app.alertError(err.message);
}
- Chats.notifyTyping(roomId, false);
});
}
};
diff --git a/public/src/modules/chat.js b/public/src/modules/chat.js
index 8cd0e45d1c..7721b6e70a 100644
--- a/public/src/modules/chat.js
+++ b/public/src/modules/chat.js
@@ -65,25 +65,6 @@ define('chat', ['components', 'taskbar', 'string', 'sounds', 'forum/chats', 'tra
}
});
- socket.on('event:chats.userStartTyping', function(withUid) {
- var modal = module.getModal(withUid);
- var chatContent = modal.find('.chat-content');
- if (!chatContent.length) {
- return;
- }
- var atBottom = chatContent[0].scrollHeight - chatContent.scrollTop() === chatContent.innerHeight();
-
- modal.find('.user-typing').removeClass('hide');
- if (atBottom) {
- Chats.scrollToBottom(chatContent);
- }
- });
-
- socket.on('event:chats.userStopTyping', function(withUid) {
- var modal = module.getModal(withUid);
- modal.find('.user-typing').addClass('hide');
- });
-
socket.on('event:user_status_change', function(data) {
var modal = module.getModal(data.uid);
app.updateUserStatus(modal.find('[component="user/status"]'), data.status);
@@ -322,7 +303,6 @@ define('chat', ['components', 'taskbar', 'string', 'sounds', 'forum/chats', 'tra
chatModal.remove();
chatModal.data('modal', null);
taskbar.discard('chat', chatModal.attr('UUID'));
- Chats.notifyTyping(chatModal.attr('roomId'), false);
if (chatModal.attr('data-mobile')) {
module.disableMobileBehaviour(chatModal);
@@ -391,7 +371,6 @@ define('chat', ['components', 'taskbar', 'string', 'sounds', 'forum/chats', 'tra
taskbar.minimize('chat', uuid);
clearInterval(chatModal.attr('intervalId'));
chatModal.attr('intervalId', 0);
- Chats.notifyTyping(chatModal.attr('roomId'), false);
};
module.toggleNew = taskbar.toggleNew;
diff --git a/src/socket.io/modules.js b/src/socket.io/modules.js
index 62f4b4d2e3..26426b9f9f 100644
--- a/src/socket.io/modules.js
+++ b/src/socket.io/modules.js
@@ -266,31 +266,6 @@ SocketModules.chats.renameRoom = function(socket, data, callback) {
], callback);
};
-SocketModules.chats.userStartTyping = function(socket, data, callback) {
- sendTypingNotification('event:chats.userStartTyping', socket, data, callback);
-};
-
-SocketModules.chats.userStopTyping = function(socket, data, callback) {
- sendTypingNotification('event:chats.userStopTyping', socket, data, callback);
-};
-
-function sendTypingNotification(event, socket, data, callback) {
- if (!socket.uid || !data || !data.roomId) {
- return;
- }
-
- Messaging.getUidsInRoom(data.roomId, 0, -1, function(err, uids) {
- if (err) {
- return callback(err);
- }
- uids.forEach(function(uid) {
- if (socket.uid !== parseInt(uid, 10)) {
- server.in('uid_' + uid).emit(event, data.fromUid);
- }
- });
- });
-}
-
SocketModules.chats.getRecentChats = function(socket, data, callback) {
if (!data || !utils.isNumber(data.after)) {
return callback(new Error('[[error:invalid-data]]'));