Commit Graph

1236 Commits

Author SHA1 Message Date
Chris Hill-Scott
10f81d5d16 Make pricing table searchable
uses the same pattern as searching templates by name.
2017-07-28 15:16:17 +01:00
Chris Hill-Scott
10b87e433b Add international pricing table 2017-07-28 15:16:07 +01:00
Chris Hill-Scott
6d9434d968 Re-order page ready for new stuff 2017-07-28 15:15:02 +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
Chris Hill-Scott
5596da3ff9 Address deprecation warning around wtf Form
It’s been renamed to avoid a conflict. Not a conflict we have to worry
about. So we can just change our import and get rid of the deprecation
warning.
2017-07-26 11:18:44 +01:00
Chris Hill-Scott
68a1426e58 More Python client weirdness
There’s some weird interaction between the message attribute of the
exception and mocking.

Luckily there is an internal attribute – `_message` which doesn’t go
through all the magic.
2017-07-26 11:13:37 +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
35e39eb45b Merge pull request #1374 from alphagov/split-the-check
Split the ‘check’ template into three separate templates, add error tracking
2017-07-20 14:02:12 +01:00
Chris Hill-Scott
94bc8191ae Remove irrelevant stuff from error check pages
If you have errors in your file then there’s stuff you’re not going to
see on the page. So this doesn’t need to be in the Jinja templates that
are only used when there are errors.

Basically the conditional stuff is moving up to the level above these
templates.
2017-07-20 11:56:37 +01:00
Chris Hill-Scott
ddeed88210 Refactor check page into 3 separate templates
The check page is a very complex Jinja template. It needs breaking up
to make it easier to understand what’s going on.

I think there are three di
2017-07-20 11:47:04 +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
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
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
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
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
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
aaadd867f7 Refactor code to check whether email/sms is enabled 2017-07-05 09:15:58 +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
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
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
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
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
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
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
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
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
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
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
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