Add tilde for blank condition values

This commit is contained in:
JonnyWong16 2021-05-25 11:24:52 -07:00
parent a2b2d1d227
commit 70e88a9013
2 changed files with 4 additions and 1 deletions

View file

@ -192,6 +192,9 @@
Add custom conditions to only <em>allow certain notifications</em>. By default, all notifications will be sent if there are no conditions.
<a href="#notify-text-sub-modal" data-toggle="modal">Click here</a> for a description of all the parameters.
</p>
<p class="help-block">
A tilde (<span class="inline-pre">~</span>) can be entered as a value to indicate a empty string.
</p>
<div id="condition-widget"></div>
<input type="hidden" id="custom_conditions" name="custom_conditions" />

View file

@ -295,7 +295,7 @@ def notify_custom_conditions(notifier_id=None, parameters=None):
# Cast the condition values to the correct type
try:
if parameter_type == 'str':
values = [str(v).lower() for v in values]
values = ['' if v == '~' else str(v).lower() for v in values]
elif parameter_type == 'int':
values = [helpers.cast_to_int(v) for v in values]