Merge pull request #1407 from alphagov/no-letters-trial-mode

Don’t let users in trial mode send letters
This commit is contained in:
Chris Hill-Scott
2017-08-24 13:58:43 +01:00
committed by GitHub
4 changed files with 82 additions and 6 deletions

View File

@@ -439,7 +439,10 @@ def _check_messages(service_id, template_type, upload_id, letters_as_pdf=False):
remaining_messages=remaining_messages,
choose_time_form=choose_time_form,
back_link=back_link,
help=get_help_argument()
help=get_help_argument(),
trying_to_send_letters_in_trial_mode=bool(
current_service['restricted'] and template.template_type == 'letter'
),
)
@@ -454,7 +457,8 @@ def check_messages(service_id, template_type, upload_id):
data['recipients'].too_many_rows or
not data['count_of_recipients'] or
not data['recipients'].has_recipient_columns or
data['recipients'].missing_column_headers
data['recipients'].missing_column_headers or
data['trying_to_send_letters_in_trial_mode']
):
return render_template('views/check/column-errors.html', **data)

View File

@@ -75,14 +75,29 @@
</p>
{% elif not recipients.allowed_to_send_to %}
{% with
count_of_recipients=count_of_recipients,
template_type_label=recipients.recipient_column_headers[0]
%}
{% include "partials/check/not-allowed-to-send-to.html" %}
{% endwith %}
{% elif trying_to_send_letters_in_trial_mode %}
<h1 class='banner-title' data-module="track-error" data-error-type="Trying to send letters in trial mode" data-error-label="{{ upload_id }}">
You cant send
{{ 'this letter' if count_of_recipients == 1 else 'these letters' }}
</h1>
<p>
In <a href="{{ url_for('.trial_mode') }}">trial mode</a> you
can only preview how your letters will look
</p>
{% elif recipients.more_rows_than_can_send %}
{% include "partials/check/too-many-messages.html" %}
{% endif %}
{{ skip_to_file_contents() }}

View File

@@ -17,7 +17,7 @@
</p>
<ul class="list list-bullet">
<li>
you can only send messages to yourself
you can only send text messages and emails to yourself
</li>
<li>
you can add people to
@@ -26,10 +26,13 @@
{% else %}
your team,
{% endif %}
then you can send messages to them too
then you can send text messages and emails to them too
</li>
<li>
you can only send 50 messages per day
you can only send 50 text messages or emails per day
</li>
<li>
you cant send any letters
</li>
</ul>