diff --git a/changedetectionio/__init__.py b/changedetectionio/__init__.py index 15e8e9e2..61e8ca3e 100644 --- a/changedetectionio/__init__.py +++ b/changedetectionio/__init__.py @@ -463,11 +463,19 @@ def changedetection_app(config=None, datastore_o=None): try: n_object = {'watch_url': request.form['window_url'], - 'notification_urls': request.form['notification_urls'].splitlines(), - 'notification_title': request.form['notification_title'].strip(), - 'notification_body': request.form['notification_body'].strip(), - 'notification_format': request.form['notification_format'].strip() + 'notification_urls': request.form['notification_urls'].splitlines() } + + # Only use if present, if not set in n_object it should use the default system value + if 'notification_format' in request.form and request.form['notification_format'].strip(): + n_object['notification_format'] = request.form.get('notification_format', '').strip() + + if 'notification_title' in request.form and request.form['notification_title'].strip(): + n_object['notification_title'] = request.form.get('notification_title', '').strip() + + if 'notification_body' in request.form and request.form['notification_body'].strip(): + n_object['notification_body'] = request.form.get('notification_body', '').strip() + notification_q.put(n_object) except Exception as e: return make_response({'error': str(e)}, 400) diff --git a/changedetectionio/notification.py b/changedetectionio/notification.py index 44fec5c6..58e028cb 100644 --- a/changedetectionio/notification.py +++ b/changedetectionio/notification.py @@ -89,7 +89,7 @@ def process_notification(n_object, datastore): n_body = jinja2_env.from_string(n_object.get('notification_body', default_notification_body)).render(**notification_parameters) n_title = jinja2_env.from_string(n_object.get('notification_title', default_notification_title)).render(**notification_parameters) n_format = valid_notification_formats.get( - n_object['notification_format'], + n_object.get('notification_format', default_notification_format), valid_notification_formats[default_notification_format], ) diff --git a/changedetectionio/static/js/notifications.js b/changedetectionio/static/js/notifications.js index 33673042..6b855b18 100644 --- a/changedetectionio/static/js/notifications.js +++ b/changedetectionio/static/js/notifications.js @@ -26,9 +26,6 @@ $(document).ready(function() { data = { window_url : window.location.href, notification_urls : $('.notification-urls').val(), - notification_title : $('.notification-title').val(), - notification_body : $('.notification-body').val(), - notification_format : $('.notification-format').val(), } for (key in data) { if (!data[key].length) {