Add note about letters

When trying to send letters using the API, the ‘team and whitelist’ key
is confusing. We don’t have addresses for your team members, nor is
there a whitelist for letter addresses. The actual behaviour is that
you’ll get an error if you try to use this key to send letters.

So, for services who have letters available, we should add a hint
telling users that team and whitelist is probably not the key they’re
looking for.
This commit is contained in:
Chris Hill-Scott
2017-10-03 13:15:52 +01:00
parent f93a0c074b
commit 9c25b2d2da
3 changed files with 30 additions and 4 deletions

View File

@@ -69,14 +69,15 @@ def create_api_key(service_id):
(KEY_TYPE_TEAM, 'Team and whitelist limits who you can send to'),
(KEY_TYPE_TEST, 'Test pretends to send messages'),
]
disabled_options, option_hints = [], {}
if current_service['restricted']:
disabled_options = [KEY_TYPE_NORMAL]
option_hints = {KEY_TYPE_NORMAL: Markup(
option_hints[KEY_TYPE_NORMAL] = Markup(
'This option is not available because your service is in '
'<a href="{}#trial-mode">trial mode</a>'.format(url_for(".using_notify"))
)}
else:
disabled_options, option_hints = [], {}
)
if 'letter' in current_service['permissions']:
option_hints[KEY_TYPE_TEAM] = 'Cant be used to send letters'
if form.validate_on_submit():
if form.key_type.data in disabled_options:
abort(400)