mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-11 09:28:27 -04:00
dont let people get into one-off flow for deleted templates
previously we'd skip the template page entirely if someone didnt have manage templates/api keys permission. however, if the template is deleted you'd then go through the flow entering placeholders and stuff before it would then crash when trying to send. instead, just bounce the user to the template page. It has the content and says when the template was deleted.
This commit is contained in:
@@ -77,11 +77,12 @@ def unicode_truncate(s, length):
|
||||
return encoded.decode('utf-8', 'ignore')
|
||||
|
||||
|
||||
def should_skip_template_page(template_type):
|
||||
def should_skip_template_page(db_template):
|
||||
return (
|
||||
current_user.has_permissions('send_messages')
|
||||
and not current_user.has_permissions('manage_templates', 'manage_api_keys')
|
||||
and template_type != 'letter'
|
||||
and db_template['template_type'] != 'letter'
|
||||
and not db_template['archived']
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user