Add notifier text preview

This commit is contained in:
JonnyWong16 2016-11-02 22:52:24 -07:00
parent cb5252b8d4
commit d874697eef
6 changed files with 91 additions and 4 deletions

View file

@ -557,7 +557,7 @@ def build_server_notify_params(notify_action=None, **kwargs):
return available_params
def build_notify_text(subject='', body='', notify_action=None, parameters=None, agent_id=None):
def build_notify_text(subject='', body='', notify_action=None, parameters=None, agent_id=None, test=False):
media_type = parameters.get('media_type')
all_tags = r'<movie>.*?</movie>|' \
@ -596,8 +596,13 @@ def build_notify_text(subject='', body='', notify_action=None, parameters=None,
default_body = default_action.get('body', '')
# Use default subject and body if they are blank
subject = subject or default_subject
body = body or default_body
# only if the notification is not script
if agent_id != 15:
subject = subject or default_subject
body = body or default_body
if test:
return subject, body
try:
subject = unicode(subject).format(**parameters)