From ce1d2a0fd91e032fb8d8240c2d1c2fb37092e80e Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Tue, 27 Sep 2016 21:48:09 -0700 Subject: [PATCH] Fix success message show incorrectly when sending test notification * Due to saving the settings before sending the notification --- data/interfaces/default/js/script.js | 4 ++-- data/interfaces/default/notification_config.html | 6 +++--- data/interfaces/default/settings.html | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/data/interfaces/default/js/script.js b/data/interfaces/default/js/script.js index 4ad59f45..50b255d2 100644 --- a/data/interfaces/default/js/script.js +++ b/data/interfaces/default/js/script.js @@ -80,9 +80,9 @@ function confirmAjaxCall(url, msg, loader_msg, callback) { }); } -function doAjaxCall(url, elem, reload, form, callback) { +function doAjaxCall(url, elem, reload, form, showMsg, callback) { // Set Message - feedback = $("#ajaxMsg"); + feedback = (showMsg) ? $("#ajaxMsg") : $(); update = $("#updatebar"); if (update.is(":visible")) { var height = update.height() + 35; diff --git a/data/interfaces/default/notification_config.html b/data/interfaces/default/notification_config.html index 35f43fa6..33d89d1f 100644 --- a/data/interfaces/default/notification_config.html +++ b/data/interfaces/default/notification_config.html @@ -148,7 +148,7 @@ $('#save-notification-item').click(function () { // Reload modal to update certain fields - doAjaxCall('set_notification_config', $(this), 'tabs', true, reloadModal); + doAjaxCall('set_notification_config', $(this), 'tabs', true, true, reloadModal); return false; }); @@ -176,7 +176,7 @@ }) $('#test_notifier').click(function () { - doAjaxCall('set_notification_config', $(this), 'tabs', true, sendTestNotification); + doAjaxCall('set_notification_config', $(this), 'tabs', true, false, sendTestNotification); }); function sendTestNotification() { @@ -219,7 +219,7 @@ $('#pushbullet_apikey, #pushover_apitoken, #scripts_folder, #join_apikey').on('change', function () { // Reload modal to update certain fields - doAjaxCall('set_notification_config', $(this), 'tabs', true, reloadModal); + doAjaxCall('set_notification_config', $(this), 'tabs', true, false, reloadModal); return false; }); diff --git a/data/interfaces/default/settings.html b/data/interfaces/default/settings.html index 0cef29cc..bfedd48f 100644 --- a/data/interfaces/default/settings.html +++ b/data/interfaces/default/settings.html @@ -2204,7 +2204,7 @@ $(document).ready(function() { function saveSettings() { if (configForm.parsley().validate()) { - doAjaxCall('configUpdate', $(this), 'tabs', true, postSaveChecks); + doAjaxCall('configUpdate', $(this), 'tabs', true, true, postSaveChecks); return false; } else { showMsg(' Please verify your settings.', false, true, 5000, true)