Skip to content

Commit

Permalink
Autosave new conversation draft when choosing recipient - closes #3538
Browse files Browse the repository at this point in the history
  • Loading branch information
freescout-help-desk committed Nov 23, 2023
1 parent a8b4a58 commit ce4bebb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/Http/Controllers/ConversationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2303,6 +2303,8 @@ public function ajax(Request $request)
'prev_conversations' => $prev_conversations,
])->render();
$response['status'] = 'success';
} else {
$response['msg'] = 'Customer not found';
}
break;

Expand Down
6 changes: 5 additions & 1 deletion public/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1768,7 +1768,10 @@ function convEditorInit()

// New conversation: load customer info
$("#to").on('change', function(event) {
var to = $('#to').val()
// Autosave to be able to populate customer placeholders in the body
autosaveDraft();

var to = $('#to').val();
//var clean_customer = true;
// Do not clean customer info if customer has not changed
/*if (Array.isArray(to) && to.length == 1 && typeof(to[0]) != "undefined") {
Expand Down Expand Up @@ -4094,6 +4097,7 @@ function saveDraft(reload_page, no_loader, do_not_save_empty)
if (!$('.form-reply:visible:first :input[name="thread_id"]:first').val()
&& !$('#body').val()
&& !$('.form-reply:visible:first .thread-attachments li.attachment-loaded:first').length
&& !$('#to').val()
) {
fs_processing_save_draft = false;
return;
Expand Down

0 comments on commit ce4bebb

Please sign in to comment.