Skip to content

Commit 3221593

Browse files
josaphatimamaninyumu1
authored andcommitted
Fix showing wait message while no draft is saving
1 parent aa31793 commit 3221593

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

modules/smtp/js_modules/route_handlers.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ function applySmtpComposePageHandlers() {
113113
}
114114

115115
async function handleSendAnyway() {
116-
// if ($('.compose_draft_id').val() == '0') {
117-
// Hm_Notices.show([hm_trans('Please wait, sending message...')]);
118-
// await waitForValueChange('.compose_draft_id', '0');
119-
// }
116+
if ($('.saving_draft').val() !== '0') {
117+
Hm_Notices.show([hm_trans('Please wait, sending message...')]);
118+
await waitForValueChange('.saving_draft', '0');
119+
}
120120

121121
if (handleMissingAttachment()) {
122122
if ($('.nexter_input').val()) {

modules/smtp/modules.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,6 +1159,7 @@ protected function output() {
11591159
'<input type="hidden" name="next_email_post" class="compose_next_email_data" value="" />'.
11601160
'<input type="hidden" name="compose_msg_uid" value="'.$this->html_safe($msg_uid).'" />'.
11611161
'<input type="hidden" class="compose_draft_id" name="draft_id" value="'.$this->html_safe($draft_id).'" />'.
1162+
'<input type="hidden" class="saving_draft" name="draft_id" value="0" />'.
11621163
'<input type="hidden" class="compose_in_reply_to" name="compose_in_reply_to" value="'.$this->html_safe($in_reply_to).'" />'.
11631164

11641165
'<div class="to_outer">'.

modules/smtp/site.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ var save_compose_state = function(no_files, notice, schedule, callback) {
9393
if (!body && !subject && !to && !cc && !bcc) {
9494
return;
9595
}
96-
$('.compose_draft_id').val(0)
96+
$('.saving_draft').val(1);
9797
Hm_Ajax.request([{'name': 'hm_ajax_hook', 'value': 'ajax_smtp_save_draft'},
9898
{'name': 'draft_body', 'value': body},
9999
{'name': 'draft_id', 'value': draft_id},
@@ -109,6 +109,7 @@ var save_compose_state = function(no_files, notice, schedule, callback) {
109109
{'name': 'schedule', 'value': schedule ?? ''},
110110
{'name': 'compose_delivery_receipt', 'value': delivery_receipt ?? ''}],
111111
function(res) {
112+
$('.saving_draft').val(0);
112113
if (res.draft_id) {
113114
$('.compose_draft_id').val(res.draft_id);
114115
}
@@ -121,7 +122,11 @@ var save_compose_state = function(no_files, notice, schedule, callback) {
121122
}
122123
},
123124
[],
124-
no_icon
125+
no_icon,
126+
false,
127+
function () {
128+
$('.saving_draft').val(0);
129+
}
125130
);
126131
};
127132

0 commit comments

Comments
 (0)