Commit Graph

3595 Commits

Author SHA1 Message Date
Pete Herlihy
b73a306718 52-53 for Immigration Asylum Chamber Tribunal 2017-06-02 11:26:22 +01:00
minglis
e478d2f820 Merge pull request #1298 from alphagov/revert-dashboard-changes
Revert "Merge pull request #1288 from alphagov/add-new-rate-logic"
2017-06-02 10:50:58 +01:00
Martyn Inglis
0dbd3fa10d Revert "Merge pull request #1288 from alphagov/add-new-rate-logic"
This reverts commit adbff63d1f, reversing
changes made to 80f0b4b2a2.
2017-06-02 10:41:42 +01:00
minglis
adbff63d1f Merge pull request #1288 from alphagov/add-new-rate-logic
Wire in the new API method that calculates the total cost and total billable units
2017-06-02 09:52:19 +01:00
Martyn Inglis
790aa250e4 Merge branch 'add-new-rate-logic' of github.com:alphagov/notifications-admin into add-new-rate-logic 2017-06-01 17:05:07 +01:00
Martyn Inglis
e236cc4cbe Fixed typo and moved the sms free limit into the config. 2017-06-01 17:04:41 +01:00
minglis
8f70dcf549 Fix typo 2017-06-01 16:55:49 +01:00
minglis
74e79e175b Fix typo 2017-06-01 16:53:36 +01:00
Chris Hill-Scott
80f0b4b2a2 Merge pull request #1297 from alphagov/search-outbound
Add search box to filter notifications by recipient
2017-06-01 16:09:20 +01:00
Chris Hill-Scott
20f1d73f76 Merge pull request #1293 from alphagov/one-off
Make ‘send a one-off message’ a thing
2017-06-01 14:46:07 +01:00
Chris Hill-Scott
f12e0fde39 Ensure the tour sidebar gets shown
I accidentally broke it by removing a parameter. This commit reinstates
that parameter and adds some tests to make sure it doesn’t happen again.
2017-06-01 14:27:55 +01:00
Chris Hill-Scott
6425dcbc94 Rename the feature to ‘send to one recipient’
‘One-off’ is a bit wooly. Feels like our name for the thing. ‘Send to
one recipient’ matches ‘Upload recipients’.

This also means making the `<h1>` on job page ‘Report’ for one-off
messages. It doesn’t make sense to call the feature ‘send to one
recipient’ when we’re not using the language of one-off any more.
2017-06-01 14:27:25 +01:00
Chris Hill-Scott
43f6d21e1d Replace test with one-off
It’s a confusing proposition to have two features which are almost
identical. Even differentiating between them in the template menu would
be tricky.

I think the better thing to do is rename the whole feature to ‘send
one-off message’.

Then if someone wants to use there own phone number or email address,
give them a quick shortcut to doing that, once they’re in the flow.
In the background this reuses the ‘send yourself a test’ code, but
the user is never aware that they’re going through a different route
to send an individual message. So the proposition stays nice and clean.
2017-06-01 14:26:49 +01:00
Chris Hill-Scott
82549c817a Ensure correct page titles on send test flows
We have some fairly complicated nested if statements in our Jinja that
decide what the page titles should be. It’s only going to get more
complicated with the send individual message routes.

So this commit:
- moves the logic from Jinja to Python
- adds tests to check things are working as expected
- sets the page titles to the right thing for each flow
2017-06-01 14:26:14 +01:00
Chris Hill-Scott
27c1463213 Validate recipients in send a one-off message
It would be annoying to get all the way to the end of the flow and get
told that the phone number or email address you entered isn’t valid.

So this commit reuses the existing WTForms objects that we have to do
some extra validation on the first step in the send one-off message
flow. It also accounts for international phone numbers, if the service
is allowed to send them.

It doesn’t reject other people’s phone numbers if your service is
restricted, because I think it’s better to let users play with the
feature – it’s good for learning.
2017-06-01 14:25:41 +01:00
Chris Hill-Scott
7310e8b435 Make send one-off route ask for phone number/email
This commit adds an extra, initial, step to the ‘send one-off message’
flow to ask for a phone number or email address. This is the first pass
at making a feature which caseworkers or similar could use Notify to
send individual messages while they’re working a case.
2017-06-01 14:25:04 +01:00
Chris Hill-Scott
311732ff9d Add test for international phone no. 2017-05-31 11:53:10 +01:00
Chris Hill-Scott
b9bf18b936 Add a form to filter notifications by recipient
Because manually editing the URL isn’t a great user interface, this
commit adds a search field to do this on the user’s behalf.

For this pass at the story it doesn’t do any validation – the user will
just get no results if they search by something which isn’t a phone
number or email address.

If the user navigates to a different ‘bucket’ of notifications (eg
delivered, failed) then the search term is reset, because they’ve
changed the filter which is at a level above the search term.
2017-05-30 15:11:34 +01:00
Chris Hill-Scott
f41830e5d3 Add query string parameter to search by recipient
> Service teams that use the admin interface often need to know the
> outcome of a message... at the moment they have to page through all
> the results in the activity stream. They should be able to find
> notifications by email address or phone number.

– https://www.pivotaltracker.com/n/projects/1443052

This commit adds an additional query string parameter (`to`) to the URL,
which users can use to filter down the list of notifications.

It:
- takes the status into account
- doesn’t update the counts based on the search term (in reality each
  service will only send a handful of notifications to one person in any
  7 day period)

In other words the funnel that filters down the notifications looks
like:

> all notifications for service → only failed → only to this phone
> number
2017-05-30 15:06:56 +01:00
Chris Hill-Scott
eabd9fcbf1 Add a third route through populating a template
This commit adds a route which is identical to send yourself a test, but
with its own endpoint. This will let us add a slightly different
‘send a one-off message’ flow. This commit just adds the route though,
and makes sure that the tests pass for both routes.
2017-05-30 10:33:48 +01:00
Chris Hill-Scott
d516f19a33 Merge pull request #1292 from alphagov/tidy-tests
Combine related tests into one
2017-05-30 10:30:46 +01:00
Rebecca Law
1ff47446ad Merge pull request #1296 from alphagov/whitelist-domain
Add cjsm.net to whitelist
2017-05-26 11:05:05 +01:00
Rebecca Law
a1d004fa45 Add cjsm.net to whitelist 2017-05-26 10:40:48 +01:00
Chris Hill-Scott
c27f349285 Merge pull request #1295 from alphagov/51-52
51-52 for HMCTS Registration
2017-05-25 15:39:26 +01:00
Chris Hill-Scott
af0057e89d Merge pull request #1290 from alphagov/add-tail-sms
Add tail to SMS messages
2017-05-25 15:39:19 +01:00
Pete Herlihy
8cb16b28cb 51-52 for HMCTS Registration 2017-05-25 15:35:14 +01:00
Chris Hill-Scott
d5fb0bd858 Merge pull request #1294 from alphagov/dont-hit-template-preview-in-tests
Don’t hit template preview app when running tests
2017-05-25 15:06:59 +01:00
Chris Hill-Scott
ff00058847 Don’t hit template preview app when running tests
It’s annoying for tests to pass locally because the template preview app
is running locally, but fail on Jenkins because the template preview app
doesn’t exist.

This commit changes it’s hostname to use a dummy port in tests.
2017-05-25 15:03:49 +01:00
Chris Hill-Scott
d04bdaa6fb Combine related tests into one
These tests were both requesting the same page with the same input,
saves a lot of boilerplate if they’re not separated.
2017-05-25 08:31:58 +01:00
Chris Hill-Scott
47c55ccb2b Add tail to SMS message
Because:
- drawing things in CSS is fun
- when we have inbound messages, having a tail pointing the other way
  will help differentiate which messages are inbound
2017-05-24 16:14:02 +01:00
Chris Hill-Scott
217e975ae9 Clean up unused SCSS in SMS message component
Things we don’t do with SMS messages any more:
- put paragraphs in them (we use `<br>` tags instead, to allow for
  multiple linebreaks)
- pick them using radio buttons
- render the template’s name as part of the template
- render the phone number that the message will be sent from as part of
  the template
2017-05-24 14:18:23 +01:00
Martyn Inglis
52326539d6 Wire in the new API method that calculates the total cost and total billable units.
- Used on dashboard to calculate free tier/cost
- Update tests to mock new method
- Two new tests to check output on dashboard page
2017-05-24 10:35:52 +01:00
Chris Hill-Scott
3dc530e741 Merge pull request #1287 from alphagov/error-on-row
Error on row
2017-05-24 10:13:46 +01:00
Chris Hill-Scott
5c4d3b02b8 Merge pull request #1282 from alphagov/show-errors-first
Show spreadsheet before template if there’s errors
2017-05-23 14:39:10 +01:00
Chris Hill-Scott
a9b15ced40 Merge pull request #1279 from alphagov/placeholders-in-contact-block
Enable placeholders in letter contact block
2017-05-23 14:39:00 +01:00
Chris Hill-Scott
f425c5756d Make sure row numbers stay vertically aligned
Just looks tidier.
2017-05-23 14:36:27 +01:00
Chris Hill-Scott
a0cc792222 Make row numbers bold
They’re headings, not part of the data.
2017-05-23 14:36:26 +01:00
Chris Hill-Scott
ad5fc9a583 Put error flag on whole row
We’ve seen people miss errors if they’re in the right-hand columns of
the spreadsheet because people’s eyes scan down the left edge of the
table.
2017-05-23 14:33:22 +01:00
Chris Hill-Scott
1c1c5bd758 Merge pull request #1285 from alphagov/from-always-set
Use GOVUK as fallback SMS sender
2017-05-23 13:55:35 +01:00
Chris Hill-Scott
616fec9d77 Remove 40604 as fallback
We should just be using whatever is in the database. Should not be
merged until the DB migration is done.
2017-05-23 13:36:48 +01:00
Chris Hill-Scott
eab15f252b Merge pull request #1284 from alphagov/validate-sms-sender
Stop letting people enter empty SMS senders
2017-05-23 12:55:14 +01:00
Chris Hill-Scott
1aebb10fe9 Merge pull request #1277 from alphagov/send-test-page-per-thing
Show one field at a time on send yourself a test
2017-05-23 12:45:24 +01:00
Chris Hill-Scott
1d76b22bc0 Add extra tests to make sure that the form is safe
Previous implementations of this functionality mutated the base form
class, which broke a bunch of stuff.

I want to make sure that getting this form for one placeholder doesn’t
change other forms that have already been instantiated for other
placeholders.

Mutation is scary.
2017-05-22 12:12:22 +01:00
Chris Hill-Scott
cd7c27925c Check that users can’t skip steps in send test
Because we put the step in the URL, users could:
- skip ahead to a later step
- navigate to a step which doesn’t exist (ie an index greater than the
  number of placeholders)

This commit adds some checks to do the sensible thing in the unlikely
event that either of these situations occur.
2017-05-22 12:12:22 +01:00
Chris Hill-Scott
c8a64aeb19 Clean up unused test fixtures
The combination of `service_one` and `logged_in_client` takes care of
most of the permissions stuff.
2017-05-22 12:12:22 +01:00
Chris Hill-Scott
5da24288f2 Remove unused import 2017-05-22 10:52:41 +01:00
Chris Hill-Scott
e7896f283a Cache letter page count on send yourself test
Calculating the number of pages in a letter is quite slow. And the send
yourself a test pages need to load _fast_. Since filling in placeholders
is very unlikely to change the number of pages in the resultant letter,
it’s pretty safe to cache that count, and makes the subsequent pages
load a lot faster.
2017-05-22 10:52:06 +01:00
Chris Hill-Scott
16c7d17329 Unfill current placeholder if revisiting page
If we don’t do this then you can’t see where in the composed message
the value for your placeholder will appear.
2017-05-22 10:51:39 +01:00
Chris Hill-Scott
7169a7fbf8 Focus form field on send yourself a test
People are going to hammer through this form _fast_, so not making them
click into the form field on every page load is a nice enhancement.

Reuses the code written to do this on the page where you enter your
verification code.
2017-05-22 10:51:13 +01:00
Chris Hill-Scott
3106ea0e15 Make send yourself a test form stay at top of page
You might need to scroll this page quite a lot to see where a
placeholder appears in your template – especially if you have a long
email or letter.

One of the things I’m trying to stop happening so much is a lot of
scrolling back and forth. This would happen if you were scrolling down
to see the placeholder, then back up to fill in its value.

So this commit makes the textbox ‘sticky’, ie it always stays at the top
of the viewport, even when you scroll down. This lets you see the
placeholder and the textbox side by side, no matter how long the
template is.

The code to do this mostly comes from the GOV.UK Frontend Toolkit
(documented here: d9489a9870/docs/javascript.md (stick-at-top-when-scrolling)).
I had to add some extra CSS to make it look good when it overlaps the
content of the page, which the GOV.UK Frontend Toolkit implementation
doesn’t really anticipate.
2017-05-22 10:50:41 +01:00