Ensure trial mode error overrides too many rows

Telling users that they can’t send to more than 50 recipients in trial
mode doesn’t apply for letters (they can’t send to _any_ recipients).

So we should make sure that the error message about not being able to
send to any recipients always comes up instead of the 50 recipients one,
whether you’re trying to upload a file with 1 or 111 rows.
This commit is contained in:
Chris Hill-Scott
2017-08-08 10:31:09 +01:00
parent 8f40cbd2bb
commit 4ff674158c
3 changed files with 20 additions and 13 deletions

View File

@@ -457,14 +457,15 @@ 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)
if data['row_errors']:
return render_template('views/check/row-errors.html', **data)
if data['errors'] or data['trying_to_send_letters_in_trial_mode']:
if data['errors']:
return render_template('views/check/column-errors.html', **data)
return render_template('views/check/ok.html', **data)

View File

@@ -83,10 +83,6 @@
{% include "partials/check/not-allowed-to-send-to.html" %}
{% endwith %}
{% elif recipients.more_rows_than_can_send %}
{% include "partials/check/too-many-messages.html" %}
{% 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 }}">
@@ -98,6 +94,10 @@
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() }}