Commit Graph

1795 Commits

Author SHA1 Message Date
Leo Hemsted
ad8e95302c fix pete's broken tests 2018-06-15 16:27:17 +01:00
Katie Smith
33277ce3e2 Make a contact_link required when turning upload_document permission on
When a platform admin user clicks on the button to add the
'upload_document' permission to a service, they should be taken to the
page to add a contact_link if the service does not already have one.
2018-06-12 10:21:24 +01:00
Katie Smith
8a559aceb5 Display contact link on service settings page
The contact link for the service now gets displayed on the service
settings page if the service has the 'upload_document' permission. There
are no changes to the appearance of the service settings page if a
service does not have the 'upload_document' permission.
2018-06-12 10:21:24 +01:00
Katie Smith
02988c224b Merge pull request #2100 from alphagov/contact-url-page
Add page to change a service's contact link
2018-06-12 10:20:51 +01:00
Katie Smith
e1d4181be3 Add page to change a service's contact link
Added a page which lets users with the 'manage_service' permission change the
contact link for their service. There are no links to this page yet
since only services using document download will need to set a contact
link.
2018-06-11 10:36:18 +01:00
Chris Hill-Scott
4b37ca4021 Don’t duplicate columns in example spreadsheet
If a template has a placeholder like `((email address))` then the sample
spreadsheet and CSV file have the email column twice.

Trying to upload this spreadsheet will result in a ‘duplicate column’
error.

This commit fixes it so that the column will only appear once.
2018-06-08 13:28:02 +01:00
Chris Hill-Scott
1fc4e1657d Merge pull request #2108 from alphagov/no-redact-letters
Don’t let people redact letter templates
2018-06-08 10:20:27 +01:00
Chris Hill-Scott
8137f9c3a6 Don’t let people redact letter templates
It doesn’t work, so we shouldn’t show the link.
2018-06-07 13:43:34 +01:00
Chris Hill-Scott
ea6620083b Persist original file name when previewing row 2018-06-07 11:03:09 +01:00
Chris Hill-Scott
e74d408953 Allow users to preview all letters in trial mode
If you’re in trial mode you can’t send letters for real. But you can
still upload a spreadsheet with multiple rows, and there’s no reason why
you shouldn’t be able to explore how Notify populate the letter for each
row of the spreadsheet (since this is something we let you do when you
can send the messages for real).
2018-06-07 11:03:09 +01:00
Rebecca Law
2bece35aba Docker is using a different version of pytest, and assert_called_once is newly introduced. 2018-06-06 15:46:18 +01:00
Rebecca Law
84445d154d When someone complains about an email from the platform we get a callback from SES.
A new platform admin page Email complaints has been added to surface those complaints.
Eventually the complaints will be visible to the services so they can remove the email address from their mailing list.

Next thing to implement is "x email complaints" warning on the platform admin summary page.
2018-06-06 15:22:48 +01:00
Rebecca Law
6bdb8b7210 Rename the method for usage and update the tests. 2018-05-29 15:31:40 +01:00
Katie Smith
58cc1604a7 Bump utils and sanitise header values
Updated notifications-utils. This brings in
- the renamed character sanitization classes
- the change to allow unicode in letter addresses (this lets us delete
a test that is no longer relevant)

Also replaced non-ascii characters in headers. This fixes a bug where
non-ascii characters in a CSV filename were causing errors since the
filename is also used in the header.
2018-05-25 10:34:47 +01:00
Pete Herlihy
3459f74110 Merge pull request #2093 from alphagov/privacy-page
Privacy page
2018-05-23 15:42:18 +01:00
Pete Herlihy
aa8992c7b9 Testing that the privacy page exists 2018-05-23 14:36:36 +01:00
Rebecca Law
cd09c391e8 Letter have multliple rates, the agregate number was not taking that into account for the usage page. 2018-05-22 17:37:48 +01:00
Chris Hill-Scott
79314de817 Add page where users can say they want branding
At the moment branding is an undocumented feature. We get a bunch of
support tickets from teams asking its possible.

This commit:
- lets people know it’s possible, and what the options are
- is the first step towards making this process as self-service as
  possible

In some cases we will be able to infer a user’s organisation from there
email address, and Google image search their logo. So the experience for
them is that they press a button and government just sorts it out for
you (also known as "the dream").

In other cases we will have to get back to people asking for a copy of
their logo, or to find out about their service, but this is what we have
to do at the moment anyway.
2018-05-18 16:24:20 +01:00
Leo Hemsted
3097fb75ee fix usage page sms rate calculation
usage page used to make the assumption that the first row of the usage
stats would always be SMS. This now isn't always the case, so make sure
when working out the rate, it only looks at sms rows. Specifically, it
takes the rate from the first stats row. This makes a big assumption
that all the rows will have the same rate per financial year.
2018-05-17 10:40:48 +01:00
Rebecca Law
c721c40ec7 Ignore temporary endpoint in navigation test 2018-05-16 13:23:49 +01:00
Chris Hill-Scott
7b759963b7 Merge pull request #2073 from alphagov/back-to-only-authed
Only show ‘back to service name’ link if signed in
2018-05-14 15:36:16 +01:00
Chris Hill-Scott
fc87ec70a7 Merge pull request #2072 from alphagov/test-domains
Check that all domains in our lists are valid
2018-05-14 15:36:07 +01:00
Chris Hill-Scott
e5c1c68942 Merge pull request #2074 from alphagov/sign-in-for-agreement
Let people choose which agreement to download if signed in
2018-05-14 15:35:57 +01:00
Chris Hill-Scott
3a471e2f61 Stop overwriting S3 metadata with empty filename
When you upload a CSV the check page takes the file name from the URL
and writes it to the S3 metadata for that file.

This also happens when you go to the .png version of this page.

The .png version of the page doesn’t have the filename in the URL. So it
re-writes the S3 metadata with an empty filename.

This means that all letter jobs sent recently have no file names. This
commit fixes this problem.
2018-05-10 17:01:03 +01:00
Chris Hill-Scott
f9421789d0 Only show ‘back to service name’ link if signed in
When you’re not signed in you can still have a service in your session.
But there’s no point trying to get to its dashboard until you’re signed
in – you’ll just be sent back to the ‘sign in’ page.
2018-05-09 15:32:46 +01:00
Leo Hemsted
5f4d9a60da Merge pull request #2075 from alphagov/statistics-endpoint
use service statistics endpoint instead of detailed service
2018-05-09 14:46:56 +01:00
Leo Hemsted
78a6f86043 use service statistics endpoint instead of detailed service
we're not actually looking at the detailed service aspects - just
the stats. We're doing this in three places:

* dashboard
* notification activity page
* when checking jobs to see if we're over the daily limit

change these places to use a new api endpoint (service/id/statistics),
which hopefully be a little more performant, and will definitely be a
little more organised - moving away from generic endpoints with loads
of optional parameters.

We still need the detailed endpoints for the platform admin page tho.

Depends on https://github.com/alphagov/notifications-api/pull/1865
2018-05-09 14:00:24 +01:00
Chris Hill-Scott
220e11ccdd Customise download page if agreement signed
If the user’s organisation has already signed the agreement we shouldn’t
give them the instructions for how to sign it.
2018-05-09 13:44:33 +01:00
Chris Hill-Scott
dc6d66daba Make people sign in to get the agreement
Currently we have a bunch of users who aren’t signed in asking us for
the agreement.

This is bad because:
- it’s slower (for them) than just being able to download it
- it creates work for us

We can’t just offer the agreement to anyone, but we can offer to it to
anyone who’s signed in because we now let people self-select which
version to download when we can’t tell which one to give them.
2018-05-09 13:41:51 +01:00
Chris Hill-Scott
947b67ee1a Let people choose which agreement to download
If we don’t know whether people belong to a crown organisation we should
give them the option of self-selecting, because they might themselves
know.

This commit adds a new version of the ‘agreement’ page which gives
people exactly that choice. It doesn’t link to it yet.
2018-05-09 13:40:21 +01:00
Chris Hill-Scott
952a83f23a Merge pull request #2068 from alphagov/2fa-input
Improve 2fa code input
2018-05-08 16:53:54 +01:00
Chris Hill-Scott
060b93c4d4 Check that all domains in our lists are valid
Since we have too many to add individual tests every time we add a new
one now.
2018-05-08 15:25:41 +01:00
Chris Hill-Scott
3aa688d1e5 Merge pull request #2071 from alphagov/public-agreement
Add URLs to download the agreement without login
2018-05-08 14:56:47 +01:00
Chris Hill-Scott
771f916630 Add URLs to download the agreement without login
So that we can share these URLs in an email we’re sending out.
2018-05-08 14:49:06 +01:00
Chris Hill-Scott
0e1e5ccecc Merge pull request #2070 from alphagov/manheadschool
Adding mansheadschool to the whitelist of domains
2018-05-08 14:29:53 +01:00
Pete Herlihy
bb7973f753 Adding a test for mansheadschool whitelisting domain 2018-05-08 11:42:04 +01:00
Leo Hemsted
e47a459757 Merge pull request #2066 from alphagov/mock-tests
Make sure we always mock endpoints in tests
2018-05-08 11:37:51 +01:00
Leo Hemsted
4ddd3aa155 use client_request to always check the response
this'll avoid us accidentally 503ing and ignoring it in tests where we
check for "assert my_content not present"
2018-05-08 11:16:12 +01:00
Chris Hill-Scott
02907afce1 Refactor sms_code functionality into the class
So it’s all in one place, not two.
2018-05-08 11:03:01 +01:00
Chris Hill-Scott
063f9cc081 Enable numeric keypad for text message code
If you’re signing in on a phone, it’s easier to type the two factor code
with a numeric keypad. The most reliable way to get the numeric keypad
to show up on multiple devices is:
- `type='tel'` (not `type='number'` because that’s only meant for
  numbers, not string of digits, ie `01234` is not a number)
- `pattern='[0-9]*'`, without which it doesn’t work on iOS

Based on the guidance here:
- https://github.com/alphagov/govuk-design-system-backlog/issues/74
- https://docs.google.com/document/d/1wozIhOdt6wvlgqVReauUnlsJI-3fqUlNuQFwUI7tqAA/edit
2018-05-08 10:55:42 +01:00
Chris Hill-Scott
4d678aec93 Give better error messages for incorrect code
If we know the code won’t pass the validation on the API side, we might
as well tell the user before even passing it to the API.

So this commit:
- adds some more validators to the field
- rewrites the validation function on the form to actually call the
  field-level validators before hitting the API 🤦‍♂️
- refactors the tests to be parametrize, which means they can be
  shorter, easier to read, and more comprehensive
2018-05-08 10:53:22 +01:00
Leo Hemsted
7656d3d567 ensure create_email_branding is mocked in tests
also fix asserts to check status codes (to make sure it's not 500)
2018-05-03 16:33:37 +01:00
Leo Hemsted
236339435c conversations only looks for 404 errors from inbound sms
stops masking some 503s in tests
2018-05-03 16:33:37 +01:00
Leo Hemsted
09a8e863a4 in send flow replace suppress with try catch
suppress was suppressing 404 errors (the happy path) - but it was also
suppressing 503s from tests where we hadn't mocked endpoints
2018-05-03 16:33:32 +01:00
Leo Hemsted
e8ef6fa174 don't swallow HTTP errors from create_event
tests weren't patching out create_event (which is invoked every time a
user logs in). This was getting caught by our egress proxy on jenkins.
We didn't notice because the event handler code was swallowing all
exceptions and not re-raising.

This changes that code to no longer swallow exceptions. Since we did
that, we also need to update all the tests that test log-in to mock
the call
2018-05-03 16:14:13 +01:00
Chris Hill-Scott
793842bb3b Let users download the crown agreement
This (partially) reverts commit dca5546cbd

Depends on

- [ ] agreement being uploaded to the bucket in all environments as
      `crown.pdf`
2018-05-02 09:54:13 +01:00
Alexey Bezhan
f663092cf4 Add a button for switching 'upload_document' permission
Adds a platform admin button to the service settings to turn on/off
'upload_document' service permission. The permission allows uploading
documents to document-download-api through the post notification API
endpoint.
2018-05-01 16:53:21 +01:00
Chris Hill-Scott
054f75a8ed Don’t load the check page if a job exists already
If a user clicks ‘back’ once they’ve sent a job we don’t want them to
land on the ‘check’ page again. This would suggest that they can send
the same job again (they can’t because that `job_id` is in the database
already). That said, it’s confusing to see that page; the natural thing
is to go jump back another step, to where you uploaded the file.
2018-05-01 09:47:05 +01:00
Chris Hill-Scott
b44074bf3a Stop writing job metadata to the session
We’re not looking at the job metadata in the session any more (see
previous commits) so it’s safe to stop writing it.
2018-05-01 09:47:05 +01:00
Chris Hill-Scott
8c04f8f21a Stop checking the session to see if a file’s valid
We’re going to stop storing job metadata in the session. So we can’t
rely on it for checking whether a file is valid. That safeguard is
happening in the API instead now (because it’s looking at the metadata
stored in S3).
2018-05-01 09:47:04 +01:00