mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-12 00:06:07 -07:00
Populate NULL text fields after a DB update
This commit is contained in:
parent
a6e8372d47
commit
1e3a347782
1 changed files with 14 additions and 4 deletions
|
@ -411,7 +411,9 @@ def get_notify_agents():
|
|||
return tuple(a['name'] for a in sorted(available_notification_agents(), key=lambda k: k['label']))
|
||||
|
||||
|
||||
def get_notify_actions():
|
||||
def get_notify_actions(return_dict=False):
|
||||
if return_dict:
|
||||
return {a.pop('name'): a for a in available_notification_actions()}
|
||||
return tuple(a['name'] for a in available_notification_actions())
|
||||
|
||||
|
||||
|
@ -475,15 +477,23 @@ def get_notifier_config(notifier_id=None):
|
|||
logger.error(u"Tautulli Notifiers :: Failed to get notifier config options: %s." % e)
|
||||
return
|
||||
|
||||
notify_actions = get_notify_actions()
|
||||
notify_actions = get_notify_actions(return_dict=True)
|
||||
|
||||
notifier_actions = {}
|
||||
notifier_text = {}
|
||||
for k in result.keys():
|
||||
if k in notify_actions:
|
||||
subject = result.pop(k + '_subject')
|
||||
body = result.pop(k + '_body')
|
||||
|
||||
if subject is None:
|
||||
subject = "" if result['agent_name'] in ('scripts', 'webhook') else notify_actions[k]['subject']
|
||||
if body is None:
|
||||
body = "" if result['agent_name'] in ('scripts', 'webhook') else notify_actions[k]['body']
|
||||
|
||||
notifier_actions[k] = helpers.cast_to_int(result.pop(k))
|
||||
notifier_text[k] = {'subject': result.pop(k + '_subject'),
|
||||
'body': result.pop(k + '_body')}
|
||||
notifier_text[k] = {'subject': subject,
|
||||
'body': body}
|
||||
|
||||
try:
|
||||
result['custom_conditions'] = json.loads(result['custom_conditions'])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue