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) {
|
switch(action) {
|
||||||
case 'post':
|
case 'post':
|
||||||
|
$(this).attr('disabled', true);
|
||||||
composer.post(post_uuid);
|
composer.post(post_uuid);
|
||||||
break;
|
break;
|
||||||
case 'discard':
|
case 'discard':
|
||||||
@@ -419,34 +420,30 @@ define(['taskbar'], function(taskbar) {
|
|||||||
'title' : titleEl.val(),
|
'title' : titleEl.val(),
|
||||||
'content' : bodyEl.val(),
|
'content' : bodyEl.val(),
|
||||||
'category_id' : postData.cid
|
'category_id' : postData.cid
|
||||||
}, function(err) {
|
}, done);
|
||||||
if(!err) {
|
|
||||||
composer.discard(post_uuid);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if (parseInt(postData.tid, 10) > 0) {
|
} else if (parseInt(postData.tid, 10) > 0) {
|
||||||
socket.emit('posts.reply', {
|
socket.emit('posts.reply', {
|
||||||
'topic_id' : postData.tid,
|
'topic_id' : postData.tid,
|
||||||
'content' : bodyEl.val()
|
'content' : bodyEl.val()
|
||||||
}, function(err) {
|
}, done);
|
||||||
if(!err) {
|
|
||||||
composer.discard(post_uuid);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if (parseInt(postData.pid, 10) > 0) {
|
} else if (parseInt(postData.pid, 10) > 0) {
|
||||||
socket.emit('posts.edit', {
|
socket.emit('posts.edit', {
|
||||||
pid: postData.pid,
|
pid: postData.pid,
|
||||||
content: bodyEl.val(),
|
content: bodyEl.val(),
|
||||||
title: titleEl.val()
|
title: titleEl.val()
|
||||||
}, function(err) {
|
}, done);
|
||||||
|
}
|
||||||
|
|
||||||
|
function done(err) {
|
||||||
|
$('.action-bar button').removeAttr('disabled');
|
||||||
if(!err) {
|
if(!err) {
|
||||||
composer.discard(post_uuid);
|
composer.discard(post_uuid);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function composerAlert(title, message) {
|
function composerAlert(title, message) {
|
||||||
|
$('.action-bar button').removeAttr('disabled');
|
||||||
app.alert({
|
app.alert({
|
||||||
type: 'danger',
|
type: 'danger',
|
||||||
timeout: 2000,
|
timeout: 2000,
|
||||||
@@ -456,7 +453,6 @@ define(['taskbar'], function(taskbar) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
composer.discard = function(post_uuid) {
|
composer.discard = function(post_uuid) {
|
||||||
if (composer.posts[post_uuid]) {
|
if (composer.posts[post_uuid]) {
|
||||||
$('#cmp-uuid-' + post_uuid).remove();
|
$('#cmp-uuid-' + post_uuid).remove();
|
||||||
@@ -464,6 +460,7 @@ define(['taskbar'], function(taskbar) {
|
|||||||
composer.active = undefined;
|
composer.active = undefined;
|
||||||
taskbar.discard('composer', post_uuid);
|
taskbar.discard('composer', post_uuid);
|
||||||
$('body').css({'margin-bottom': 0});
|
$('body').css({'margin-bottom': 0});
|
||||||
|
$('.action-bar button').removeAttr('disabled');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ SocketPosts.reply = function(socket, data, callback) {
|
|||||||
type: 'danger',
|
type: 'danger',
|
||||||
timeout: 2000
|
timeout: 2000
|
||||||
});
|
});
|
||||||
return;
|
return callback(new Error('not-logged-in'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!data || !data.topic_id || !data.content) {
|
if(!data || !data.topic_id || !data.content) {
|
||||||
|
|||||||
Reference in New Issue
Block a user