Commit Graph

3808 Commits

Author SHA1 Message Date
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
11adf17330 Merge pull request #1354 from alphagov/no-template-link-tour
Don’t link to template in tour
2017-07-04 09:51:18 +01:00
Chris Hill-Scott
5a519ae637 Merge pull request #1353 from alphagov/bump-utils-sms-character-count-validation
Bump utils to count characters in SMS properly
2017-07-04 09:51:12 +01:00
Chris Hill-Scott
8585f3bdba Merge pull request #1350 from alphagov/package-lock
Add `package-lock.json` to version control
2017-07-04 09:51:05 +01:00
Chris Hill Scott
702fa1bbb4 Bump utils to count characters in SMS properly
Brings in:
- [ ] https://github.com/alphagov/notifications-utils/pull/172
2017-07-04 09:47:53 +01:00
Chris Hill Scott
584f849a3d Don’t link to template in tour
We want people to go to the dashboard, not get distracted by clicking
the tempting blue link.
2017-07-04 09:32:09 +01:00
Chris Hill-Scott
f37c4a7f71 Merge pull request #1349 from alphagov/61-63
61-63 and 29-31 orgs
2017-07-04 09:00:55 +01:00
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
Rebecca Law
50eb94f095 Merge pull request #1352 from alphagov/fix-permission
Fix permissions for sending one off notifications.
2017-07-03 17:41:04 +01:00
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
Rebecca Law
fb256b4147 Add unit test 2017-07-03 17:21:44 +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
56a59e7729 Merge pull request #1351 from alphagov/end-tour-with-template-id
Fix link to dashboard from end of tour
2017-07-03 16:00:00 +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
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
Pete Herlihy
bb110a13dd 61-63 and 29-31 orgs
Nomis API Gateway and Enterprise Europe Network
2017-07-03 11:55:59 +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
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
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