mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-21 15:03:12 +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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const replyMsg = components.get('topic/quickreply/text').val();
|
const replyMsg = element.val();
|
||||||
const replyData = {
|
const replyData = {
|
||||||
tid: ajaxify.data.tid,
|
tid: ajaxify.data.tid,
|
||||||
handle: undefined,
|
handle: undefined,
|
||||||
@@ -74,9 +74,11 @@ define('quickreply', [
|
|||||||
}
|
}
|
||||||
|
|
||||||
ready = false;
|
ready = false;
|
||||||
|
element.val('');
|
||||||
api.post(`/topics/${ajaxify.data.tid}`, replyData, function (err, data) {
|
api.post(`/topics/${ajaxify.data.tid}`, replyData, function (err, data) {
|
||||||
ready = true;
|
ready = true;
|
||||||
if (err) {
|
if (err) {
|
||||||
|
element.val(replyMsg);
|
||||||
return alerts.error(err);
|
return alerts.error(err);
|
||||||
}
|
}
|
||||||
if (data && data.queued) {
|
if (data && data.queued) {
|
||||||
@@ -91,7 +93,7 @@ define('quickreply', [
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
components.get('topic/quickreply/text').val('');
|
element.val('');
|
||||||
storage.removeItem(qrDraftId);
|
storage.removeItem(qrDraftId);
|
||||||
QuickReply._autocomplete.hide();
|
QuickReply._autocomplete.hide();
|
||||||
hooks.fire('action:quickreply.success', { data });
|
hooks.fire('action:quickreply.success', { data });
|
||||||
|
|||||||
Reference in New Issue
Block a user