mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-22 08:21:13 -05:00
use Template.is_message_too_long rather than content_count directly
this function returns false for emails and letters so we can clean up the code and reduce duplication a little bit
This commit is contained in:
@@ -200,7 +200,7 @@ def create_template_object_for_notification(template, personalisation):
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
template_object.template_type == SMS_TYPE and
|
template_object.template_type == SMS_TYPE and
|
||||||
template_object.content_count > SMS_CHAR_COUNT_LIMIT
|
template_object.is_message_too_long()
|
||||||
):
|
):
|
||||||
message = 'Content has a character count greater than the limit of {}'.format(SMS_CHAR_COUNT_LIMIT)
|
message = 'Content has a character count greater than the limit of {}'.format(SMS_CHAR_COUNT_LIMIT)
|
||||||
errors = {'content': [message]}
|
errors = {'content': [message]}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ def _content_count_greater_than_limit(content, template_type):
|
|||||||
if template_type != SMS_TYPE:
|
if template_type != SMS_TYPE:
|
||||||
return False
|
return False
|
||||||
template = SMSMessageTemplate({'content': content, 'template_type': template_type})
|
template = SMSMessageTemplate({'content': content, 'template_type': template_type})
|
||||||
return template.content_count > SMS_CHAR_COUNT_LIMIT
|
return template.is_message_too_long()
|
||||||
|
|
||||||
|
|
||||||
def validate_parent_folder(template_json):
|
def validate_parent_folder(template_json):
|
||||||
|
|||||||
Reference in New Issue
Block a user