Commit Graph

2589 Commits

Author SHA1 Message Date
Chris Hill-Scott
ef45a1d83f Merge pull request #1343 from alphagov/show-template-as-first-step-of-tour
Change step 1 of tour to only show the template
2017-07-04 08:55:16 +01:00
Chris Hill-Scott
7c09be1d84 Merge pull request #1344 from alphagov/99-problems-but-hundred-aint-one
Never say ‘report is 100% complete…’ on job page
2017-07-04 08:55:10 +01:00
Chris Hill-Scott
c940c8a8d8 Never say ‘report is 100% complete…’ on job page
This message is meant to indicate that generating the report is still in
progress. Saying 100% contradicts this because 100% sounds like
‘complete’.

Reason this is happening is because rounding 99.5 to 0 decimal places
gives you 100.

So let’s make sure it never gets above 99.0
2017-07-03 16:56:26 +01:00
Rebecca Law
3f6930d176 Fix permissions for sending one off notifications. 2017-07-03 16:39:57 +01:00
Chris Hill Scott
140d3eeb09 Remove tour-related stuff from the job page
The tour does the send one-off thing now, rather than creating a
job.
2017-07-03 15:43:28 +01:00
Chris Hill Scott
8eed32620d Fix link to dashboard from end of tour
The notification page was different to the job page in that it
passed through the whole template, not just the ID.
2017-07-03 15:29:11 +01:00
Rebecca Law
1b1839ad30 The yearly usage section on the dashboard page takes too log as a result services with large yearly stats are timing out.
As a short term fix we have taken the yearly stats off the dashboard.

There is a plan to create permanent statistic tables to warehouse the data.
2017-07-03 11:35:55 +01:00
Chris Hill-Scott
ef567210ff Mutate dictionary instead of creating new one
Stops the case where keyword arguments could conflict.
2017-06-30 15:18:03 +01:00
Chris Hill-Scott
4b74493b0d Fix redacted placeholder style on orange BG
Also does a tiny bit more tweaking of the vertical position to get it
looking aligned correct.
2017-06-30 14:04:12 +01:00
Chris Hill-Scott
37b710b57f Style redacted placeholders
The visual convention for redaction is heavy black crossing-out.

Our text colour isn’t always black exactly though (usually it’s very
dark grey, sometimes just dark grey). `currentColor` is a magical CSS
value that let’s us set the background colour to whatever the text
colour is. So both the text and redaction look like they are part of the
same thing.

Couple of subtle visual things here:
- opacity to make the colour better match the text colour – a filled box
  naturally looks darker than thin text, so this knocks it back a bit
- an inset shadow to take a few pixels of the bottom edge – the visual
  weight of text is biased upwards because text has ore capital letters
  and ascenders than descenders – this make it look aligned visually
2017-06-30 14:04:12 +01:00
Chris Hill-Scott
bc880017e5 Respect template’s redaction preference
If a template has the `redact_personalisation` flag set, then this
commit removes the personalisation from the notification before
rehydrating the template.

We’re doing this because we have a need to not show things like one time
passwords or two factor codes when we show the content of messages.

By passing through empty personalisation, and the `redact_missing` flag,
the `Template` instance will make use of the work done in:
- [x] https://github.com/alphagov/notifications-utils/pull/171
2017-06-30 14:04:11 +01:00
Chris Hill-Scott
1d65c19c4e Refactor content preview method into generator
This will let us break up this method a bit more, rather than make the
dictionary comprehension even more involved and nested.

Means we need to `list()` it, because generator expressions cast to
boolean are `True`, even if they’re empty – Python doesn’t evaluate
them. ie:

```python
bool(list())
>>> False
```

```python
bool((item for item in list()))
>>> True
```

```python
bool(list(item for item in list()))
>>> False
```
2017-06-30 14:04:10 +01:00
Chris Hill-Scott
4798258e62 Add redact_missing argument to get_template
Adds an interface to use:
https://github.com/alphagov/notifications-utils/pull/171
2017-06-30 14:04:10 +01:00
Chris Hill-Scott
9f20ea4b7e Revert "Merge pull request #1336 from alphagov/revert-show-notifications"
This reverts commit 7e354ff341, reversing
changes made to 6f3bcff32f.
2017-06-30 14:01:18 +01:00
Leo Hemsted
0b6b659bc0 if on the tour check notification page (step 2), show back link
Back link redirects to beginning of tour.

Additionally, this fixes a problem where you'd get a 500 when using
the browser back button
2017-06-30 12:48:44 +01:00
Leo Hemsted
ef4d3d111f help (aka tour) now works correctly throughout the notification flow 2017-06-30 11:49:03 +01:00
Leo Hemsted
87aeec1b8d add other send notification error branches and tests 2017-06-29 16:10:59 +01:00
Leo Hemsted
42e33ce9e6 make partials source-agnostic
they're currently expecting a RecipientsCSV object - but we won't
always have that available if we're handling a single notification.

So make the partials take generic variables, and then use a jinja with
block to pass in the correct values from either the check csv page or
the check notification page.

Additionally set the notification check page to show errors nicely -
hide the send button if there were problems, and replace the header
2017-06-29 15:33:31 +01:00
Leo Hemsted
70914bfe8a display errors on the end page.
The following errors may happen:
* Number outside of service if service in trial mode
* Message too long for sms
* Service over daily limit

We need to handle these. They only return on send, rather than in a
separate validation step (for now).
2017-06-29 15:31:44 +01:00
Leo Hemsted
f1ecee8469 add template partials for some notification checks
also move out some from the check.html page. This is going to help
with sharing templates between single notifications and csv files.
2017-06-29 12:40:03 +01:00
Leo Hemsted
4eb35a9aa6 make error handler work if only one error message 2017-06-29 12:40:03 +01:00
Leo Hemsted
a31bf0c5ce add tests for new check and send notification endpoints 2017-06-29 12:40:03 +01:00
Leo Hemsted
de92950d8e make sure recipient details always rendered 2017-06-29 12:40:03 +01:00
Leo Hemsted
47aaebacc3 iron out kinks in recipient/placeholder handling
where we were previously setting the placeholder when going through
the send self a test - however, should be setting recipient. Also,
only do this on step-0 of the one-off route, not the send-test route,
since step-0 of send-test is the first normal placeholder. Phew!
2017-06-29 12:40:03 +01:00
Leo Hemsted
e46b635551 separate recipient from rest of placeholders when sending notification
note: in the case of letters, we still want to create a CSV file. This
only modifies the code flow when it's an email or template 😩

renamed `send_test_values` to `placeholders` because a) that's what
they are and b) this isn't just for sending a test message any more
2017-06-29 12:40:03 +01:00
Leo Hemsted
40f805c230 add new endpoints for one-off flow
rather than creating a job, after entering the placeholders, you now
send a single notification. This means we don't clog up s3 by creating
lots of one line CSV files.
2017-06-29 12:40:03 +01:00
Leo Hemsted
16df91766f rename template var in send_test_step
it's confusing reassigining one template (json from api) to another
type (utils object) on one line.

Also removed an unnecessary bounds check (since if placeholders is
empty the IndexError will throw on the next line anyway and it'll
be handled the same), and moved get_back_link out to its own function
2017-06-29 12:40:03 +01:00
Leo Hemsted
3966d024d8 add new send_notification api call 2017-06-29 12:40:03 +01:00
Chris Hill-Scott
480a57bba4 Change step 1 of tour to only show the template
We’ve made a few changes to the tour recently, without changing the
help text on the left hand side of the screen. So the stuff you see on
the right side of the screen doesn’t quite sync up any more.

This commit adds an extra, introductory page that just shows the
template and a next button, which better matches the ‘every message
starts with a template’ help text.
2017-06-29 12:16:47 +01:00
Chris Hill-Scott
6e48dc7689 Add a message saying a template has been redacted
This is useful if it’s been redacted by someone who isn’t you.
2017-06-28 15:27:09 +01:00
Chris Hill-Scott
afbe175d15 Attach current user to redact client method
Not sure how to test this, but we need it.
2017-06-28 15:27:08 +01:00
Chris Hill-Scott
79217a02bb Split views into GET and POST 2017-06-28 15:27:08 +01:00
Chris Hill-Scott
9569521142 Add feature to mark a template as redacted
Works similarly to the delete template flow, because it’s a destructive,
one-way action.

Not on the edit template page, because it’s not something you want to be
considering every time you’re editing a template. And we saw that people
couldn’t find the delete button when it was on this page.

Adds a bit more CSS for the `dangerous` banner type, because the content
here is quite complicated. Breaking it into a list helps, but the
spacing didn’t look right, so needed some tweaking.

Can ship independently of the code that shows the redaction, but needs
the API first.
2017-06-28 15:27:07 +01:00
Chris Hill-Scott
4b89ee5d1d Merge pull request #1342 from alphagov/60-61
60-61 HMCTS Money Claim
2017-06-27 17:12:41 +01:00
Chris Hill-Scott
c39707a458 Merge pull request #1339 from alphagov/quis-patch-1
Add more nuance to time filter
2017-06-27 17:12:27 +01:00
Pete Herlihy
00e474a4b4 60-61 HMCTS Money Claim 2017-06-27 14:51:36 +01:00
kentsanggds
8202c44202 Merge pull request #1335 from alphagov/ken-use-new-service-permissions
Use new service permissions
2017-06-27 11:27:12 +01:00
Ken Tsang
f624215bbf Refactor inbound_sms to use switch_service_permissions 2017-06-27 11:17:06 +01:00
Chris Hill-Scott
75e9d0949c Add more nuance to time filter
Saying X seconds is more precise than we need to be.
2017-06-26 17:16:55 +01:00
Chris Hill-Scott
4b212fbc76 Add logo for Enterprise Europe Network 2017-06-26 11:21:19 +01:00
Chris Hill-Scott
b450a349a3 Revert "Merge pull request #1328 from alphagov/notification-page-reworked"
This reverts commit 1797162248, reversing
changes made to 95b4d9eb31.
2017-06-23 15:56:25 +01:00
Chris Hill-Scott
5c0f6796e4 Revert "Merge pull request #1333 from alphagov/fix-empty-table-message"
This reverts commit 114bac7b80, reversing
changes made to 69445380d9.
2017-06-23 15:55:54 +01:00
Chris Hill-Scott
c52bfc5b81 Revert "Merge pull request #1334 from alphagov/fix-missing-recipient-on-notification-page"
This reverts commit 6f3bcff32f, reversing
changes made to f8a3132d8b.
2017-06-23 15:55:06 +01:00
Ken Tsang
beffaeaeea Refactor test 2017-06-23 15:29:09 +01:00
Chris Hill-Scott
4b02612d93 Fix missing recipients on notification page
For some reason:
- notifications sent from CSV files have the recipient as part of the
  personalisation
- notifications sent via the API don’t have the recipient as part of the
  personalisation

I’d only tested it locally with CSV-sent files so didn’t spot this. The
`conftest.py` fixtures we set up like the API already, but we didn’t
have an explicit test.

This commit adds a method to append the recipient to the
personalisation, so we can populate the template with it.
2017-06-23 14:43:39 +01:00
Ken Tsang
bcc45ede9c Refactored code for new service permissions 2017-06-23 14:27:41 +01:00
Chris Hill-Scott
3e335c3250 Hide template nav if service has one of each
There are a bunch of services that just have one text message template
and one email template.

In this case the template navigation is essentially the same as the
list of templates – a user can just differentiate by looking at the two
templates. Adding the nav would just be noise in this case.
2017-06-23 13:53:54 +01:00
Chris Hill-Scott
867143e871 Center-align pill text when there’s no big number
When the text is left aligned it looks messy because the spacing is so
uneven and there are no big numbers to give it some rhythm.
2017-06-23 13:49:27 +01:00
Chris Hill-Scott
f386b991cb Only show template navigation when it’s useful
There are lots of services that only send emails, or only send text
messages. For these services, being able to filter the list of templates
but type is pointless – it won’t cut the list down at all.

This commit adds some logic to only show the navigation if the service
has some variety of template types.
2017-06-23 13:49:26 +01:00
Chris Hill-Scott
358edf7f20 Make list of templates filterable by type
When users are trying to find a template there’s a fair chance that they
know whether or not it’s an email/text message/(letter) that they’re
looking for.

Making them scroll past a whole bunch of templates of a different type
means it will take them longer to find the template they are looking
for.

We already have search on the templates page, but this is only good for
where they can remember the name of the template. This will be
sometimes but not always.

This commit adds some navigation to filter down the list of templates to
only show one type at a time. By default it will show all templates. It
adapts the pattern we use for filtering notifications by
sending/failed/delivered, but without the counts of how many things are
in each bucket (I don’t think there’s any value in knowing you have X
text message templates; on this page you only really care
about the one template you’re looking for).

_Note: required re-arranging the functions in `templates.py`. The route
for `/template/:uuid` needs to come before the route for
`template/:string` otherwise Flask tries to interpret a template’s ID
as its type.
2017-06-23 13:49:24 +01:00