Commit Graph

12 Commits

Author SHA1 Message Date
Chris Hill-Scott
eb3734f1d1 Give the user better error messages for CSV files
Makes uses of the additions to utils in https://github.com/alphagov/notifications-utils/pull/9

This commit strips out a lot of the complex stuff that the views and templates
in this app were doing. There is now a cleaner separation of concerns:

- utils returns the number and type of errors in the csv
- `get_errors_for_csv` helper in this app maps the number and type of errors
  onto human-friendly error messages
- the view and template just doing the glueing-together of all the pieces

This is (hopefully) easier to understand, definitely makes the component
parts easier to test in isolation, and makes it easier to give more specific
error messages.
2016-03-08 18:36:22 +00:00
Chris Hill-Scott
0a5bf0bc44 Update to utils 2.0.0
…and remove the code from this app that has moved into utils.
2016-03-08 17:18:42 +00:00
Rebecca Law
e3c692ede7 Validate column heading.
Still need to show that it is the heading that is wrong.
2016-03-04 10:09:46 +00:00
Nicholas Staples
1b59e5c7f1 Review comments fixed. All tests passing. 2016-03-03 09:02:56 +00:00
Nicholas Staples
dde2fba705 Merge with master again. 2016-03-02 13:53:05 +00:00
Chris Hill-Scott
b57ac2f7e5 Accept CSVs with 'email address' or 'phone number'
CSV files currently have ‘to’ as the recipient column. This is changing in
https://github.com/alphagov/notifications-api/pull/109

The admin app also has to validate that the CSV files have the right columns,
because the API expects any CSV that it’s given to have been checked (also we
want things to actually work).

This commit is the minimum code change needed. In the future it should reuse
the same code as the API for processing CSV files. This will need more thinking.
2016-03-02 10:41:35 +00:00
Nicholas Staples
ffe30c3070 Permissions added for templates and send_messages pages. All tests passing.
Fix up page heading.
2016-02-29 17:18:12 +00:00
Nicholas Staples
58351a094c Merge with master. 2016-02-29 14:59:15 +00:00
Nicholas Staples
48943527ec API keys hooked up and working. All tests passing. 2016-02-29 14:57:07 +00:00
Chris Hill-Scott
1e46922876 Make send the send flow generic
This commit parameterises all methods in the send view so that they can send
either emails or SMS messages.

It works out what kind of message it is sending from the `template_type`
property of the template object.

This means that the `Template` util class needs to know about these properties,
which means that this commit depends on:
https://github.com/alphagov/notifications-utils/pull/2

This commit does _not_ add tests for sending emails. The existing tests for
sending SMS still pass, but actually sending emails is outside the scope of
this story.
2016-02-24 09:23:38 +00:00
Nicholas Staples
32e37d89fb User permissions added with test. 2016-02-19 16:38:04 +00:00
Chris Hill-Scott
45cacd82d3 Validate CSVs fully
This commit extends the existing function to validate each row’s phone number
to also validate that all the required data is present.

It does this using the checking that the `Template` class can do when given
a template and a `dict` of values.
2016-02-18 15:07:15 +00:00