Commit Graph

3790 Commits

Author SHA1 Message Date
Chris Hill Scott
7d2500d8d9 Don’t show diffs for package-json.lock
We don’t care about how this file changes.
2017-07-03 17:29:51 +01:00
Chris Hill Scott
8e19dc194a Add package-lock.json to version control
`package-lock.json` is a file that newer versions of NPM generated
when installing dependencies.

> It describes the exact tree that was generated, such that
> subsequent installs are able to generate identical trees,
> regardless of intermediate dependency updates.

> This file is intended to be committed into source repositories.

– https://docs.npmjs.com/files/package-lock.json
2017-07-03 12:11:24 +01:00
Rebecca Law
c791771498 Merge pull request #1348 from alphagov/remove-yearly-usage-from-dashboard
Remove yearly usage from dashboard
2017-07-03 11:57: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
9bdc1bebfe Merge pull request #1347 from alphagov/dict-key-conflict
Mutate dictionary instead of creating new one
2017-06-30 15:20:45 +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
0b296ed8de Merge pull request #1337 from alphagov/notification-page-with-redactions
Show full message content, but redacted in some cases
2017-06-30 14:36:08 +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
8115dab8e4 Merge pull request #1345 from alphagov/help-i-need-somebody
help (aka tour) now works correctly throughout the notification flow
2017-06-30 13:27:48 +01:00
Rebecca Law
885086dd8a Fix codestyle 2017-06-30 13:09:59 +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
f31767e492 Merge pull request #1340 from alphagov/send-one-off
Send one off messages without jobs
2017-06-29 16:24:21 +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
1e979394bb Merge pull request #1341 from alphagov/redaction-setting
Add feature to mark a template as redacted
2017-06-29 11:41:45 +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
1dbd6a122d Make client_request understand POST-redirect-GET
When we do a `POST` we almost always do a redirect straight afterwards.
`client_request` understands this, and expects a `302` by default.

However, if the `_follow_redirects` flag is set the status code returned
is that of the subsequent request – normally a `GET`, itself returning
`200`. Therefore the default expected response code would need to be
overridden.

Overriding this repeatedly would get pretty boring. Better to do it once
inside the fixture.
2017-06-28 15:27:06 +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
Rebecca Law
c4684c692b Merge pull request #1338 from alphagov/een
Add logo for Enterprise Europe Network
2017-06-26 11:39:57 +01:00
Chris Hill-Scott
4b212fbc76 Add logo for Enterprise Europe Network 2017-06-26 11:21:19 +01:00
Chris Hill-Scott
7e354ff341 Merge pull request #1336 from alphagov/revert-show-notifications
Revert show notifications
2017-06-23 16:11:47 +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
6f3bcff32f Merge pull request #1334 from alphagov/fix-missing-recipient-on-notification-page
Fix missing recipients on notification page
2017-06-23 15:03:10 +01:00