diff --git a/data/interfaces/default/newsletter_config.html b/data/interfaces/default/newsletter_config.html index 71ece2ed..f1309976 100644 --- a/data/interfaces/default/newsletter_config.html +++ b/data/interfaces/default/newsletter_config.html @@ -540,7 +540,7 @@ } function sendTestNewsletter() { - showMsg('  Generating Newsletter', false); + showMsg('  Sending Newsletter', false); $.ajax({ url: 'send_newsletter', data: { diff --git a/data/interfaces/default/notifier_config.html b/data/interfaces/default/notifier_config.html index 9028131e..977d8895 100644 --- a/data/interfaces/default/notifier_config.html +++ b/data/interfaces/default/notifier_config.html @@ -775,13 +775,11 @@ }, cache: false, async: true, - complete: function (xhr, status) { - if (xhr.responseText.indexOf('sent') > -1) { - var msg = '  ' + xhr.responseText; - showMsg(msg, false, true, 2000); + success: function (data) { + if (data.result === 'success') { + showMsg(' ' + data.message, false, true, 5000); } else { - var msg = '  ' + xhr.responseText; - showMsg(msg, false, true, 2000, true); + showMsg(' ' + data.message, false, true, 5000, true); } } }); diff --git a/plexpy/webserve.py b/plexpy/webserve.py index aafd9183..72041e12 100644 --- a/plexpy/webserve.py +++ b/plexpy/webserve.py @@ -3222,6 +3222,7 @@ class WebInterface(object): return parameters @cherrypy.expose + @cherrypy.tools.json_out() @requireAuth(member_of("admin")) def send_notification(self, notifier_id=None, subject='Tautulli', body='Test notification', notify_action='', **kwargs): """ Send a notification using Tautulli. @@ -3248,20 +3249,19 @@ class WebInterface(object): if notifier: logger.debug(u"Sending %s%s notification." % (test, notifier['agent_label'])) - if notification_handler.notify(notifier_id=notifier_id, - notify_action=notify_action, - subject=subject, - body=body, - **kwargs): - return "Notification sent." - else: - return "Notification failed." + notification_handler.add_notifier_each(notifier_id=notifier_id, + notify_action=notify_action, + subject=subject, + body=body, + manual_trigger=True, + **kwargs) + return {'result': 'success', 'message': 'Notification queued.'} else: logger.debug(u"Unable to send %snotification, invalid notifier_id %s." % (test, notifier_id)) - return "Invalid notifier id %s." % notifier_id + return {'result': 'success', 'message': 'Invalid notifier id %s.' % notifier_id} else: logger.debug(u"Unable to send %snotification, no notifier_id received." % test) - return "No notifier id received." + return {'result': 'success', 'message': 'No notifier id received.'} @cherrypy.expose @cherrypy.tools.json_out()