mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-15 20:13:02 +01:00
refactor: clear quick reply as soon as submitting
bring back message on error
This commit is contained in:
@@ -60,7 +60,7 @@ define('quickreply', [
|
||||
return;
|
||||
}
|
||||
|
||||
const replyMsg = components.get('topic/quickreply/text').val();
|
||||
const replyMsg = element.val();
|
||||
const replyData = {
|
||||
tid: ajaxify.data.tid,
|
||||
handle: undefined,
|
||||
@@ -74,9 +74,11 @@ define('quickreply', [
|
||||
}
|
||||
|
||||
ready = false;
|
||||
element.val('');
|
||||
api.post(`/topics/${ajaxify.data.tid}`, replyData, function (err, data) {
|
||||
ready = true;
|
||||
if (err) {
|
||||
element.val(replyMsg);
|
||||
return alerts.error(err);
|
||||
}
|
||||
if (data && data.queued) {
|
||||
@@ -91,7 +93,7 @@ define('quickreply', [
|
||||
});
|
||||
}
|
||||
|
||||
components.get('topic/quickreply/text').val('');
|
||||
element.val('');
|
||||
storage.removeItem(qrDraftId);
|
||||
QuickReply._autocomplete.hide();
|
||||
hooks.fire('action:quickreply.success', { data });
|
||||
|
||||
Reference in New Issue
Block a user