Node.js based forum software built for the modern web
closes #896
Baris Soner Usaklied401de16991
diff --git a/public/src/modules/composer.js b/public/src/modules/composer.jsindex 7f14fe0035..bf1a8f896c 100644--- a/public/src/modules/composer.js+++ b/public/src/modules/composer.js@@ -151,6 +151,7 @@ define(['taskbar'], function(taskbar) {switch(action) {case 'post':+ $(this).attr('disabled', true);composer.post(post_uuid);break;case 'discard':@@ -419,34 +420,30 @@ define(['taskbar'], function(taskbar) {'title' : titleEl.val(),'content' : bodyEl.val(),'category_id' : postData.cid- }, function(err) {- if(!err) {- composer.discard(post_uuid);- }- });+ }, done);} else if (parseInt(postData.tid, 10) > 0) {socket.emit('posts.reply', {'topic_id' : postData.tid,'content' : bodyEl.val()- }, function(err) {- if(!err) {- composer.discard(post_uuid);- }- });+ }, done);} else if (parseInt(postData.pid, 10) > 0) {socket.emit('posts.edit', {pid: postData.pid,content: bodyEl.val(),title: titleEl.val()- }, function(err) {- if(!err) {- composer.discard(post_uuid);- }- });+ }, done);+ }++ function done(err) {+ $('.action-bar button').removeAttr('disabled');+ if(!err) {+ composer.discard(post_uuid);+ }}}function composerAlert(title, message) {+ $('.action-bar button').removeAttr('disabled');app.alert({type: 'danger',timeout: 2000,@@ -456,7 +453,6 @@ define(['taskbar'], function(taskbar) {});}-composer.discard = function(post_uuid) {if (composer.posts[post_uuid]) {$('#cmp-uuid-' + post_uuid).remove();@@ -464,6 +460,7 @@ define(['taskbar'], function(taskbar) {composer.active = undefined;taskbar.discard('composer', post_uuid);$('body').css({'margin-bottom': 0});+ $('.action-bar button').removeAttr('disabled');}}diff --git a/src/socket.io/posts.js b/src/socket.io/posts.jsindex cf5c05a444..8581ad3a98 100644--- a/src/socket.io/posts.js+++ b/src/socket.io/posts.js@@ -16,7 +16,7 @@ SocketPosts.reply = function(socket, data, callback) {type: 'danger',timeout: 2000});- return;+ return callback(new Error('not-logged-in'));}if(!data || !data.topic_id || !data.content) {