Commit Graph

1246 Commits

Author SHA1 Message Date
Chris Hill-Scott
4ff674158c 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.
2017-08-08 11:13:48 +01:00
Chris Hill-Scott
8f40cbd2bb Don’t let users in trial mode send letters
Users in trial mode haven’t signed the MOU. This means that they haven’t
agreed to pay for any costs they incur.

Unlike text messages and emails, we don’t give you any free allowance of
letters. Sending _any_ letters will cost the user money.

Therefore we shouldn’t let users who haven’t agreed that they will pay
for the service to incur costs by sending letters.

The pattern used for this is roughly the same as other trial mode errors
that we have already, ie a red box that says you’re not allowed. Not
sure if this is exactly right because it’s not exactly an error so the
pattern might feel too heavy-handed.

Getting this in place means we can turn letters on for users in trial
mode without worrying that they’ll accidentally send real letters, which
would result in:
- us having to absorb those costs
- some awkward conversations
2017-08-08 10:10:06 +01:00
Imdad Ahad
5a81064f07 Update message for last used template on delete:
* API now returns an empty response if a template was last used more than seven
* days ago
* Handle the empty response appropriately
2017-08-01 13:51:27 +01:00
Chris Hill-Scott
1e1dd49312 Fix big numbers on new platform admin page
Turns out the counts were all showing as zero because the generator had
already been consumed by the time we were trying to do the stats. Making
it a list comprehension means it can’t get exhausted.
2017-07-31 11:29:04 +01:00
Chris Hill-Scott
41ee0ba9c8 Merge pull request #1382 from alphagov/break-up-platform-admin
Break up platform admin
2017-07-31 09:37:20 +01:00
Chris Hill-Scott
432db3180b Merge pull request #1379 from alphagov/consistent-banners
Make banners more consistent
2017-07-31 09:37:13 +01:00
kentsanggds
08ee08760a Merge pull request #1392 from alphagov/ken-update-org-logos-use-s3
Update org logos to use logo CDN
2017-07-28 15:27:10 +01:00
Ken Tsang
796fe0472f Renamed test 2017-07-28 15:19:20 +01:00
Chris Hill-Scott
5c9572805e Fix error messages on one off sending
This was causing a 500 in production.

This commit:
- reverts the code the working state it was before 68a1426e58
- figures out a way to make the tests pass without breaking the actual
  app
- confirms that mocking things is hard
2017-07-27 16:34:15 +01:00
Ken Tsang
123247a178 Refactor test 2017-07-27 16:30:26 +01:00
Ken Tsang
35f66cae23 Update emails to use logos cdn 2017-07-27 16:10:59 +01:00
Chris Hill-Scott
17a7f5f2c6 Remove last used message if key’s never been used
I don’t think it adds anything to tell you that a key’s never been used.
The value of the ‘key was used 3 minutes ago’ message is in stopping you
accidentally revoking something you shouldn’t have.
2017-07-27 11:52:55 +01:00
Chris Hill-Scott
befe93ec0b Make sure confirmation/danger banners have a H1
This makes errors on all pages have a `<h1>` element, which is important
for accessibility. It means a bit of rewriting the messages, but I think
they’re better for it.
2017-07-27 11:52:54 +01:00
Chris Hill-Scott
40e79c6827 Use confirmation banner for revoking API keys
Currently revoking an API key takes you to a separate page. It should
work the same way as other destructive actions, ie staying on the same
page but with a banner asking you to confirm the action.
2017-07-27 11:52:54 +01:00
Chris Hill-Scott
ae1a0b4804 Merge pull request #1387 from alphagov/fix-breaking-change-python-client
Fix things that broke when I merged Pyup’s changes
2017-07-26 11:42:01 +01:00
Chris Hill-Scott
5fdbbda022 For some reason we’re generating XHTML <br>s now
¯\_(ツ)_/¯
2017-07-26 11:15:55 +01:00
Chris Hill-Scott
9f9c2d5e87 Fix test which looks at text of radio buttons
Looks like `radio_button.text` no longer works. Probably a BeautifulSoup
change. More robust to look at the text of the label and the value of
the input anyway.
2017-07-26 11:12:32 +01:00
Chris Hill-Scott
5ddbe80ea9 Fix calls to API client which now takes fewer args
The Notify API client changed in version 4 to take two arguments, not
three (service ID was removed in favour of the combined API key).

This gets a bit gnarly because the API key has to be at least a certain
length so it can be substringed internally.
2017-07-26 11:10:37 +01:00
Chris Hill-Scott
05707a1700 Remove list of services from platform admin index
We have two new pages for live and trial services that:
- are faster loading
- are now linked to

So the list of services doesn’t need to be on the platform admin index
page any more.
2017-07-26 07:56:20 +01:00
Chris Hill-Scott
26b333512c Add separate pages to view live/trial services
We have a lot of services now. Mostly we want to look at what live
services are doing. So loading up the trial mode services every time
slows things – generating, rendering and using the page – right down.

This commit adds two new pages, one to view only live services, and one
to view trial mode services.
2017-07-26 07:56:19 +01:00
Chris Hill-Scott
a58d881647 Make one-off error refer to correct message type
This was hard coded to say ‘You can’t send to this phone number’ even
when you were trying to send an email.
2017-07-26 07:50:01 +01:00
Chris Hill-Scott
2291c4faf4 Make sure errors on one-off flow have red border
When I split up the error messages on the check CSV page into multiple
templates, I also reduced the repetition of wrapping `<div>`s and macro
calls by moving them up outside the conditional blocks (see
8e947f315d).

Unfortunately I didn’t make the same adjustments for the one-off flow,
which meant that errors on these pages lost their styling. This commit
re-adds the styling for these error messages.
2017-07-26 07:46:20 +01:00
Chris Hill-Scott
32ae0a9b36 Merge pull request #1364 from alphagov/letter-job-page-real
Customise the job page to make sense for letters
2017-07-21 13:10:09 +01:00
Chris Hill-Scott
cfd44c94f6 Fix error message for missing cells in CSV file
This was causing a 500 because of a bug in utils. It only occurred when
there was missing data for a cell in the recipient column. I’ve also
added a test for missing data in a non-recipient column just in case.
2017-07-20 15:51:07 +01:00
Chris Hill-Scott
68078041dd Show personalisation in individual letters
Adds a new endpoint that works like view template/view preview of
letter, so that this page works the same way it does for emails/text
messages (ie showing the full content of the message, including
personalisation).

We’re not worrying about redaction in letters for now.
2017-07-19 19:01:39 +01:00
Chris Hill-Scott
63e9ef44e7 Don’t show status for individual letters
The status won’t ever change from sending for letters. For now at least.
And even when we do come up with more useful statuses I’m not convinced
it’s useful to expose them to our admin users.

A more useful piece of information to show is when we think the letter
will be delivered.
2017-07-19 19:01:39 +01:00
Chris Hill-Scott
35e7866b96 Merge pull request #1372 from alphagov/correct-descalation-link
Fix broken link in support process
2017-07-19 09:13:31 +01:00
Chris Hill-Scott
3950c6938d Show confirmation after pressing big green button
There’s no immediate feedback with letter jobs, unlike email or text
messages jobs where you see the numbers starting to tick over straight
away.

We need to reassure the user that the thing they asked us to do (send
letters) is underway. ‘Printing’ feels like the natural first state of
the letter-making process. So this commit adds a banner to tell the
user that printing is the thing that’s happening.
2017-07-18 11:00:54 +01:00
Chris Hill-Scott
ad897cd820 Hide report on letter job 2017-07-18 11:00:53 +01:00
Chris Hill-Scott
7881753193 Replace blue boxes with total + delivery estimate
The sending/failed/delivered thing:
- doesn’t map to the actual states of letters
- doesn’t respond quickly enough to give you feedback that something is
  happening (because "sending" doesn’t even go to "probably delivered"
  for a few days)

This commit replaces these 4 boxes with some more useful information:
- one number – how many letters were in the job in total
- when we estimate that the letters will be delivered
2017-07-18 11:00:08 +01:00
Chris Hill-Scott
202c9aea62 Hide status for individual letters
The status for each letter in a job will be the same for every single
letter (at least until we start dealing with returns).

It’s redundant to show this information over and over again. This commit
removes it.
2017-07-18 10:37:54 +01:00
Chris Hill-Scott
a282850a0c Allow get template fixture to accept version
The other template fixtures do, because the real API call does, it was
omitted from the letter equivalent.
2017-07-18 10:37:54 +01:00
Chris Hill-Scott
9a81489066 Merge pull request #1362 from alphagov/letter-delivery-estimates
Add function to estimate letter delivery date
2017-07-18 09:44:56 +01:00
Chris Hill-Scott
109b41a430 Fix broken link in support process
The idea is if you decide your problem isn’t such an emergency after
all, we direct you to the form where you can report it as such. This
link wasn’t working because it didn’t understand `False` to mean ‘not
severe’. Only ‘no’ means not severe.

The result was that users got sent in a bit of a convoluted loop
where they were asked again if their problem was an emergency or not.

Testing this by making sure that both:
- the URL in the link is what we expected
- when visited it gives the page title we expect

Because even if we had had the first test only, it wouldn’t have caught
this bug.
2017-07-15 07:23:22 +01:00
Chris Hill-Scott
e20483c462 Add print timings to letter timings
It will also be useful to know (especially for the API):
- when a letter was printed
- if it’s been printed or not

This commit:
- adds code to calculate these two pieces of information
- refactors the function to return a `namedtuple` – a tuple of two items
  was manageable, but with four items it was getting hard to know what
  each one meant – this lets us label each piece of information that is
  being returned
2017-07-14 20:09:23 +01:00
Chris Hill-Scott
cfbe767dff Test permissions on the inbox updates 2017-07-13 14:58:24 +01:00
Chris Hill-Scott
5f6351762a Make inbox page update using AJAX
Fairly self-explanatory. Uses the same pattern of breaking things up
into functions as the jobs page.
2017-07-12 17:10:27 +01:00
Chris Hill-Scott
dc3f26a646 Make conversation page update using AJAX
Fairly self-explanatory. Uses the same pattern of breaking things up
into functions as the jobs page.
2017-07-12 17:09:33 +01:00
Chris Hill-Scott
dca0fce1e4 Merge pull request #1361 from alphagov/fix-permissions-inbox
Fix wrong permissions on dashboard pages
2017-07-12 16:07:13 +01:00
Chris Hill-Scott
c1a5cad0d6 Add function to estimate letter delivery date
Letter delivery depends on:
- how long it takes to print
- how long it takes to post

Both of these process are impacted by weekends, because people don’t
work on weekends.

It also depends on if you submit your letter before or after 5pm,
because that’s the cut off time for getting a letter printed on a given
day – ie after 5pm on Monday is effectively the same as Tuesday and so
on.

But I reckon all our users need to know is roughly how long it will take
until the letter turns up on the user’s doorstep. So this commit adds
a function to calculate this. Doesn’t surface it on the front end _yet_.
2017-07-12 15:11:39 +01:00
Chris Hill-Scott
037970c48c Fix wrong permissions on dashboard pages
Anyone with access to a service should be able to see:
- monthly breakdown (non financial)
- incoming messages

Adds tests to check the same.
2017-07-12 09:07:14 +01:00
kentsanggds
18e7f3eccb Merge pull request #1346 from alphagov/allow-email-and-sms-to-be-disabled
Allow email and sms to be disabled
2017-07-10 12:43:17 +01:00
Ken Tsang
bdf3f20f4c Fixed tests 2017-07-10 12:25:01 +01:00
Chris Hill-Scott
84a291f24f No idea why this is failing on Jenkins 2017-07-07 14:16:18 +01:00
Chris Hill-Scott
91a071ce5d Fix import conflict 2017-07-07 14:04:49 +01:00
Chris Hill-Scott
61fd27c4f6 Fix 500 on two-way conversation page
We changed the schema used by the endpoint that searches for
notifications by recipient. So the admin app was looking for the wrong
thing in the JSON.

This is hard to catch in tests because it relies on our fixtures
matching what the API really returns.

This commit fixes the code to use the correct key to lookup the template
content from the JSON.

This also exposed the fact that we weren’t passing in the
personalisation any more (perhaps got lost in the re-reverts somehow)
so users were only seeing the template in the inbound view, not the
full message content.
2017-07-07 10:16:33 +01:00
Katie Smith
42a8474415 Stop users from editing/adding templates without the correct permission
If sending SMS is disabled for a service, it should not be possible to
add or modify SMS templates. If a user tries to do this, they should see
a different page with a link to go back. The same thing should happen
with email templates.
2017-07-05 09:15:32 +01:00
Katie Smith
95f9d26e91 Allow sending sms to be disabled
Platform admins can now disable sending sms for a service. If sending
sms is disabled, this will also hide all the other sms options in the
Settings table.
2017-07-05 09:15:32 +01:00
Katie Smith
5986dfd415 Allow sending emails to be disabled
Platform admins can now disable sending of emails for a service. If
sending emails is disabled, this will also hide the option to change the
Email reply to address.
2017-07-05 09:15:32 +01:00
Chris Hill Scott
17199f0c26 Test for page titles in client request fixture
We’re frequently ending up with mismatched page titles on our pages
because:
- they’re hard to spot in the browsers tab bar
- new pages are often created by copy pasting old ones

It would be hard to write some kind of macro that spat out the h1
and the page title because they go into different blocks in the
parent template.

Instead, we can catch these mistakes by testing for them. Going
forward we should be using the `client_request` fixture for testing.
So it makes sense to put the page title test in here so that we
get it for free in every test – same way we do for testing response
codes.

fixup! Test for page titles in client request fixture
2017-07-05 09:01:46 +01:00