-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Currently, if you create a subscription category with the 'Cannot unsubscribe' checkbox checked, but no 'Applies to' value, the front-facing recipient subscriptions view will throw an error due to attempting to match the user's email address against an invalid regex pattern. This also occurs if 'Applies to' is set to *.
| {% if category|can_unsubscribe:recipient.email_address %} |
PostMaster/manager/templatetags/filters.py
Lines 32 to 37 in 1323ec5
| @register.filter | |
| def can_unsubscribe(category, email_address): | |
| if category.cannot_unsubscribe and category.applies_to_email(email_address): | |
| return False | |
| return True |
https://github.com/UCF/PostMaster/blob/master/manager/models.py#L164-L168
It would be nice if the 'Applies to' value could be empty or * and prevent unsubscribes for all email addresses. Alternatively, if that's not desirable, we could show/hide the 'Applies to' field with some basic js logic depending on if 'Cannot unsubscribe' is checked, and/or add a field description that mentions the 'Applies to' field being required and that a wildcard * is not supported.