Automated emails: Extend filter by check-in state (#3489)

Co-authored-by: Richard Schreiber <schreiber@rami.io>
Co-authored-by: Raphael Michel <michel@rami.io>
This commit is contained in:
Phin Wolkwitz
2023-08-23 16:19:27 +02:00
committed by GitHub
parent c2b25bad06
commit 4baf317934
9 changed files with 220 additions and 14 deletions

View File

@@ -34,7 +34,7 @@ class RuleSerializer(I18nAwareModelSerializer):
class Meta:
model = Rule
fields = ['id', 'subject', 'template', 'all_products', 'limit_products', 'restrict_to_status',
'send_date', 'send_offset_days', 'send_offset_time', 'date_is_absolute',
'checked_in_status', 'send_date', 'send_offset_days', 'send_offset_time', 'date_is_absolute',
'offset_to_event_end', 'offset_is_after', 'send_to', 'enabled']
read_only_fields = ['id']
@@ -88,6 +88,10 @@ class RuleSerializer(I18nAwareModelSerializer):
]:
raise ValidationError(f'status {s} not allowed: restrict_to_status may only include valid states')
if full_data.get('checked_in_status') == "":
# even though "blank" is not allowed on this field, "" gets accepted without this check
raise ValidationError('empty string not allowed: use null to disable check-in based filtering')
return full_data
def save(self, **kwargs):