mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-30 18:46:01 +01:00
closes #896
This commit is contained in:
@@ -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) {
|
||||
}, 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');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user