Commit Graph

7170 Commits

Author SHA1 Message Date
Rebecca Law
5c26d7a061 Merge pull request #1922 from alphagov/update-free-allowance-for-org-type
Update the free allowance when the organisation type is changed
2018-03-02 15:37:13 +00:00
Rebecca Law
dcb3b84468 Fix syntax error 2018-03-02 15:16:33 +00:00
Rebecca Law
f7e1ca29fe Added an assert for the mocker 2018-03-02 15:09:07 +00:00
Chris Hill-Scott
1391f12239 Remove anything to do with DVLA format letters 2018-03-02 14:30:45 +00:00
Chris Hill-Scott
1cfcb42606 Merge pull request #1921 from alphagov/duplicate-cols-error
Catch duplicate recipient columns in spreadsheets
2018-03-02 14:25:34 +00:00
thomchambers
55e20c763a Update using-notify.html 2018-03-02 14:17:26 +00:00
Chris Hill-Scott
a4424e999f Catch duplicate recipient columns in spreadsheets
If someone has duplicate recipient columns in their file we don’t know
which one to use. This commit adds an error message which should help
them fix the duplication.

This commit doesn’t go to the extra effort to actually show the
correct values for duplication in the preview. Don’t think it’s worth
the effort/complexity for how infrequently we’ve seen this error.

Depends on:
- [ ] https://github.com/alphagov/notifications-utils/pull/376
2018-03-02 13:18:04 +00:00
Alexey Bezhan
982ea8a7fa Merge pull request #1851 from alphagov/direct-api-requests-to-paas
Add route secret key header to the API requests
2018-03-02 13:17:57 +00:00
Chris Hill-Scott
ea94d466b6 Merge pull request #1911 from alphagov/fix-date-exception
Catch exceptions caused by ambiguous Excel files
2018-03-02 12:46:26 +00:00
Chris Hill-Scott
69aa4d0025 Merge pull request #1877 from alphagov/job-csv-upgrade
Add original file data to job downloads
2018-03-02 12:46:20 +00:00
Rebecca Law
fa0196bc88 Update the free allowance when the organisation type is changed.
The free allowance affect the number of free text messages a services get per yer.
This allowance is being set properly when an organisation is created by not updated.
This PR updates the free allowance when the organisation type is updated.
The free allowance can also be changed if service has an exceptional free allowance.
2018-03-02 10:48:59 +00:00
Ken Tsang
ba6a0e6466 Fix sorting of imports 2018-03-01 23:50:55 +00:00
Ken Tsang
ff457b8407 Refactor to handle API errors for preview 2018-03-01 23:50:55 +00:00
thomchambers
600cf8c7de Update Using Notify content
Editing and updating content based on user support tickets and new features. Part of the general content batch over the last couple of days.
2018-03-01 16:27:12 +00:00
thomchambers
8479ce89f5 Update Pricing content
Similar to the other changes on Features and Security yesterday - just updating stuff based on user feedback/new features.
2018-03-01 16:24:54 +00:00
Ken Tsang
b34b0e2870 WIP refactor letter preview function 2018-03-01 15:24:26 +00:00
Ken Tsang
42622d86e1 Remove redundant code from notifications.html 2018-03-01 15:24:26 +00:00
Ken Tsang
c6285ed68b Improve preview_error.png image 2018-03-01 15:24:26 +00:00
Richard Chapman
1f69d882c2 Added some error handling if API returns an API error.
Caught the error and displayed an error PNG so it is obvious something
failed. Currently it displayed a thumbnail of a png over the top of the
loading page, and therefore it wasn't obvious of the state.
2018-03-01 15:24:26 +00:00
Ken Tsang
64e706ec76 Refactor imports 2018-03-01 15:24:26 +00:00
Richard Chapman
c52657146a Removed unneeded parameters after update to api.
Updated the tests to take the removal into account.

Tidied up unused imports
2018-03-01 15:23:16 +00:00
Ken Tsang
6279169b18 WIP refactor preview pdf 2018-03-01 15:21:50 +00:00
Richard Chapman
2b10060e49 Fixed code style changes which were making the tests fail. 2018-03-01 15:21:50 +00:00
Richard Chapman
c4f0b4d35d Moved the notifications code to go to admin to get the the template
preview document rather than go to template preview.

This will remove the logic from admin and place it in api so it is
easier to expand on later when there are precompiled PDFs
2018-03-01 15:21:50 +00:00
Katie Smith
68fc6b5cb4 Merge pull request #1914 from alphagov/reject-sms-senders-starting-with-00
Update SMS sender validation to reject senders starting with 00
2018-03-01 13:56:23 +00:00
Katie Smith
d1c724d02c Merge pull request #1916 from alphagov/pyup-update-pytest-mock-1.7.0-to-1.7.1
Update pytest-mock to 1.7.1
2018-03-01 13:56:06 +00:00
Chris Hill-Scott
91a7858c45 Merge pull request #1910 from alphagov/env-sh-fix
hardcode some development values
2018-03-01 11:21:00 +00:00
pyup-bot
435f169c2a Update pytest-mock from 1.7.0 to 1.7.1 2018-03-01 11:17:59 +00:00
Chris Hill-Scott
75976f3b59 Merge pull request #1915 from alphagov/no-priority-example
Stop creating tour text messages as priority
2018-03-01 09:56:08 +00:00
Chris Hill-Scott
6d29587d3a Merge pull request #1913 from thomchambers/patch-3
Update Features page with new content
2018-03-01 09:56:02 +00:00
Chris Hill-Scott
70e37a1af5 Merge pull request #1912 from thomchambers/patch-2
Update Security page content
2018-03-01 09:55:55 +00:00
Chris Hill-Scott
76da1ab28d Stop creating tour text messages as priority
Since we send all one off messages as priority now[1], we don’t need to
explicitly mark this template as being priority.

This stops the (potential) problem of people skipping the tour, still
having this template and then modifying it to send other messages,
potentially in high volumes from CSV files or the API. I don’t think
this is a real problem now, but worth cleaning this up.

Currently:
- 827 priority templates in the database
- 195 of which are not deleted
- 18 of which are not called ‘Example text message template’
- 3 of which look like genuine use cases, not from services that we run

[1]: https://github.com/alphagov/notifications-api/pull/1722
2018-02-28 17:00:36 +00:00
thomchambers
aadc73645e Update Features page with new content
Edited some things in here based on user support tickets and new features we've added recently.
2018-02-28 16:11:04 +00:00
Chris Hill-Scott
e899e2e826 Make it clearer what you sign in using with
Avoid confusion between and email you’re sent and an email address that is your username.
2018-02-28 16:05:16 +00:00
thomchambers
e1b77e3b13 Update Security page content
Adding some new content based on feedback from user research.
2018-02-28 15:33:47 +00:00
Chris Hill-Scott
aa7287bf64 Catch exceptions caused by ambiguous Excel files
Excel stores dates as floating point numbers, counting the days (or
fraction thereof) since 1900 (except when it counts from 1904).

However it also, incorrectly, recognises 1900 as a leap year. This means
that it’s ambiguous whether day 59 is February 28th, or February 27th,
depending if you’re counting up or down. In fact any number less than 60
is, therefore, ambiguous.

This shouldn’t really matter since no-one is going to be using dates in
the year 1900 in Notify messages. _Except_ when Excel misidentifies a
cell as containing a date. For example, if you have the number `9`
inside a cell, it means _house number 9_ if the next cell contains
_example_ street. but Excel is all like ‘oh they must want January 9th
1900!’ No. Bad Excel.

There’s not much we can do about this, but we can at least give people
an error message with the workaround, which is what this commit does.

Most of this commit message is paraphrased from:
http://xlrd.readthedocs.io/en/latest/dates.html
2018-02-28 15:09:55 +00:00
Katie Smith
11a6c8cfb5 Update SMS sender validation to reject senders starting with 00
Having SMS senders that start with 00 can cause issues with Firetext due
to Firetext's validation rules, so we shouldn't allow SMS senders to start
with 00.

Firetext treats a double 00 at the start of the senderID as an international
prefix, so removes them. A sender of 00447876574016 would become 447876574016.

Under Firetext's validation rules, an SMS sender of five 0s (00000) would
become  4400. This is because the first 00 are removed (as the international
prefix). The third 0 is seen as the start of a phone number, and becomes 44,
leaving the final 00 = 4400.
2018-02-28 13:40:20 +00:00
Alexey Bezhan
acfe8092fc Add route secret key header to the API requests
Currently requests to the API made from the admin app are going from
PaaS admin app to the nginx router ELB, which then routes them back
to the api app on PaaS.

This makes sense for external requests, but for requests made from
the admin app we could skip nginx and go directly to the api PaaS
host, which should reduce load on the nginx instances and
potentially reduce latency of the api requests.

API apps on PaaS are checking the X-Custom-Forwarder header (which
is set by nginx on proxy_pass requests) to only allow requests going
through the proxy.

This adds the custom header to the API client requests, so that they
can pass that header check without going through nginx.
2018-02-28 11:28:46 +00:00
Chris Hill-Scott
032ce6960b Refactor to not repeat loop and variables
This commit just cleans up the code a bit to:
- have less duplication
- do less assignment of single-use variables
2018-02-28 10:51:13 +00:00
Chris Hill-Scott
0934843815 Add original file data to job downloads
When downloading a report of a which messages from a job have been
delivered and which have failed we currently only include the Notify
data. This makes it hard to reconcile or do analysis on these reports,
because often the thing that people want to reconcile on is in the data
they’ve uploaded (eg a reference number).

Here’s an example of a user talking about this problem:

> It would also be helpful if the format of the delivery and failure
> reports could include the fields from the recipient's file. While I
> can, of course,  cross-reference one report with the other it would be
> easier if I did not have to. We send emails to individuals within
> organisations and it is not always easy to establish the organisation
> from a recipient's email address. This is particularly important when
> emails fail to be delivered as we need to contact the organisation to
> establish a new contact.

– ticket 677

We’ve also seen it when doing research with a local council.

This commit takes the original file, the data from the API, and munges
them together.
2018-02-28 10:51:13 +00:00
Chris Hill-Scott
aae94c8c80 Merge pull request #1886 from alphagov/import-sort
Enforce order and style of imports
2018-02-28 10:43:56 +00:00
Chris Hill-Scott
f3a0c505bd Enforce order and style of imports
Done using isort[1], with the following command:
```
isort -rc ./app ./tests
```

Adds linting to the `run_tests.sh` script to stop badly-sorted imports
getting re-introduced.

Chosen style is ‘Vertical Hanging Indent’ with trailing commas, because
I think it gives the cleanest diffs, eg:
```
from third_party import (
    lib1,
    lib2,
    lib3,
    lib4,
)
```

1. https://pypi.python.org/pypi/isort
2018-02-27 16:35:13 +00:00
Leo Hemsted
11a4a08ccb hardcode some development values
this'll ensure that you won't get your dev secret keys out of sync
between api and admin
2018-02-27 15:55:20 +00:00
Chris Hill-Scott
0217a6a962 Merge pull request #1907 from alphagov/pyup-update-pytest-xdist-1.22.1-to-1.22.2
Update pytest-xdist to 1.22.2
2018-02-27 15:45:58 +00:00
Chris Hill-Scott
29c4984adc Merge pull request #1908 from alphagov/aws-noise
Rremove awscli and boto3 from requirements
2018-02-27 15:36:21 +00:00
Chris Hill-Scott
d0ffff9e02 Check for reply to email address before going live
We require that a user has a real reply-to email address before going
live. We can partially automate this by at least telling users who
haven’t done this.

This only applies for users that have email templates; we shouldn’t
bother users who aren’t going to send emails about this.
2018-02-27 15:24:52 +00:00
Chris Hill-Scott
7be08e2f74 Check for templates before going live
We need users to have created some templates before they go live, so we
can see what kind of messages they intend to send.

We can do this automatically based on the work done in
https://github.com/alphagov/notifications-admin/pull/1892
2018-02-27 15:23:41 +00:00
Chris Hill-Scott
b731690736 Rremove awscli and boto3 from requirements
They're both brought in by utils, and are generating a lot of PR noise
by being on every repo.
2018-02-27 15:20:06 +00:00
Chris Hill-Scott
ca3fdfd907 Check for team members on request to go live page
One of the things that we want to check before a service goes live is
that they have at least two team members with the manage service
permission. Anyone who can make a request to go live has this
permission, so that means one additional user is needed. This is what we
can automatically communicate to the user.

Under the hood this makes use of the logic added in
https://github.com/alphagov/notifications-admin/pull/1891
2018-02-27 15:17:31 +00:00
Rebecca Law
81cceb1c44 Merge pull request #1901 from alphagov/becca-invite-users
Organisation invite users
2018-02-27 13:12:33 +00:00