From f2ffc2b5335d46b98e6ce8257b37d07a4fcedb07 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Sat, 1 Mar 2014 17:34:06 -0500 Subject: [PATCH 1/2] properly referencing the tid of the composer instead of blindly checking templates.get('topic_id') --- public/src/modules/composer.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public/src/modules/composer.js b/public/src/modules/composer.js index 8b30a5aacf..07bbee5c88 100644 --- a/public/src/modules/composer.js +++ b/public/src/modules/composer.js @@ -390,12 +390,13 @@ define(['taskbar'], function(taskbar) { composer.createNewComposer(post_uuid); } - var tid = templates.get('topic_id'); + var tid = templates.get('topic_id'), + postData = composer.posts[post_uuid]; if (tid) { // Replying to a topic socket.emit('modules.composer.register', { uuid: post_uuid, - tid: templates.get('topic_id'), + tid: postData.tid, uid: app.uid }); } From a9b78d2600dde260cdb30ed6fbbdbffa8279c27f Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Sat, 1 Mar 2014 17:49:39 -0500 Subject: [PATCH 2/2] minimizing the composer should unregister it --- public/src/modules/composer.js | 7 ++++--- src/socket.io/modules.js | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/public/src/modules/composer.js b/public/src/modules/composer.js index 07bbee5c88..c9457aa38a 100644 --- a/public/src/modules/composer.js +++ b/public/src/modules/composer.js @@ -390,9 +390,8 @@ define(['taskbar'], function(taskbar) { composer.createNewComposer(post_uuid); } - var tid = templates.get('topic_id'), - postData = composer.posts[post_uuid]; - if (tid) { + var postData = composer.posts[post_uuid]; + if (postData.tid) { // Replying to a topic socket.emit('modules.composer.register', { uuid: post_uuid, @@ -843,6 +842,8 @@ define(['taskbar'], function(taskbar) { postContainer.css('visibility', 'hidden'); composer.active = undefined; taskbar.minimize('composer', post_uuid); + + socket.emit('modules.composer.unregister', post_uuid); }; return { diff --git a/src/socket.io/modules.js b/src/socket.io/modules.js index ac60ef9884..8566e65786 100644 --- a/src/socket.io/modules.js +++ b/src/socket.io/modules.js @@ -78,6 +78,7 @@ SocketModules.composer.renderHelp = function(socket, data, callback) { SocketModules.composer.register = function(socket, data) { var now = Date.now(); + server.in('topic_' + data.tid).emit('event:topic.replyStart', data.uid); data.socket = socket;