From 3257f9b19616f0cebe52bf040bf1274c4fec173c Mon Sep 17 00:00:00 2001 From: Stephen Nielson Date: Wed, 8 Jun 2022 14:33:49 -0600 Subject: [PATCH] Fixes #5434 - Check New Messages button (#5437) * Fixes #5434 - Check New Messages button * Remove unneeded timeout setting, extra spaces. --- interface/main/messages/messages.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/interface/main/messages/messages.php b/interface/main/messages/messages.php index 6efae4487..7162eb411 100644 --- a/interface/main/messages/messages.php +++ b/interface/main/messages/messages.php @@ -693,6 +693,7 @@ if (!empty($_REQUEST['go'])) { ?> if ($GLOBALS['phimail_enable']) { echo "  " . xlt("Compose Trusted Direct Message") . ""; + echo "  "; } echo "
$prevlink   " . text($end) . " " . xlt('of') . " " . text($total) . "   $nextlink
@@ -825,6 +826,7 @@ if (!empty($_REQUEST['go'])) { ?> var collectvalidation = ; $(function () { + var webRoot = ; $("#reminders-div").hide(); $("#recalls-div").hide(); $("#sms-div").hide(); @@ -878,6 +880,34 @@ if (!empty($_REQUEST['go'])) { ?> ,minDate : 0 //only future }) + + $('.trusted-messages-force-check').click(function() { + window.top.restoreSession(); + request = new FormData; + request.append("ajax", "1"); + request.append("csrf_token_form", ); + request.append("background_service", "phimail"); + request.append("background_force", "1"); + fetch(webRoot + "/library/ajax/execute_background_services.php", { + method: 'POST', + credentials: 'same-origin', + body: request + }).then((response) => { + if (response.status !== 200) { + console.log('Background Service refresh failed. Status Code: ' + response.status); + } else { + // we've refreshed give them time to reload the page + setTimeout(function() { + window.location.reload(); + }, 500); + } + }).catch(function(error) { + console.log('Background Service refresh failed: ', error); + alert(window.xl("Check new messages failed. Check the server logs for more information.")); + }); + }); + + }); $(function () { $( "ul.navbar-nav" ).children().click(function(){ -- 2.11.4.GIT