From 1b268c94c0eabd04f1e3535d8e239938ef3ea4df Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 29 Oct 2014 00:10:57 -0400 Subject: [PATCH] if there is no postData.tid dont notify, ie topic post --- public/src/modules/composer.js | 7 +++++++ src/socket.io/modules.js | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/public/src/modules/composer.js b/public/src/modules/composer.js index a2e149f311..da6a995d0b 100644 --- a/public/src/modules/composer.js +++ b/public/src/modules/composer.js @@ -187,6 +187,10 @@ define('composer', dependencies, function(taskbar, controls, uploads, formatting }); } + if (!parseInt(postData.tid, 10)) { + return; + } + stopNotifyInterval(postData); emit(); @@ -194,6 +198,9 @@ define('composer', dependencies, function(taskbar, controls, uploads, formatting } function stopNotifyTyping(postData) { + if (!parseInt(postData.tid, 10)) { + return; + } socket.emit('modules.composer.stopNotifyTyping', { tid: postData.tid, uid: app.uid diff --git a/src/socket.io/modules.js b/src/socket.io/modules.js index d8ced59f1f..0c1871aac0 100644 --- a/src/socket.io/modules.js +++ b/src/socket.io/modules.js @@ -93,14 +93,14 @@ SocketModules.composer.renderHelp = function(socket, data, callback) { }; SocketModules.composer.notifyTyping = function(socket, data) { - if (!socket.uid) { + if (!socket.uid || !parseInt(data.tid, 10)) { return; } server.in('topic_' + data.tid).emit('event:topic.notifyTyping', data); }; SocketModules.composer.stopNotifyTyping = function(socket, data) { - if (!socket.uid) { + if (!socket.uid || !parseInt(data.tid, 10)) { return; } server.in('topic_' + data.tid).emit('event:topic.stopNotifyTyping', data);