Commit Graph

10151 Commits

Author SHA1 Message Date
Chris Hill-Scott
95078d2d51 Change page title on new broadcast template page
Since broadcast services can only have one type of template we probably
don’t need to disambiguate what kind of template you’re creating.

And you’ve just come from a page where the button says ‘New template’,
without the choice of radios after, so it’s nice for the page title to
match that.
2020-08-17 13:01:33 +01:00
Pea Tyczynska
36c1ffa7be New template button takes user to new template page
for all services that only allow sending one type of notifications
2020-08-14 17:15:45 +01:00
Pea Tyczynska
bdfc0adcc0 New template button creates new template for broadcast services 2020-08-14 17:13:57 +01:00
Pea Tyczynska
bf5ccd044b Services can only create templates of types they have turned on 2020-08-14 17:13:56 +01:00
Chris Hill-Scott
3573ce1437 Merge pull request #3550 from alphagov/fix-html-escaping-email-subject-preview
Fix HTML being escaped in preview of email subject
2020-08-10 08:59:44 +01:00
Chris Hill-Scott
0e99bede68 Merge pull request #3552 from alphagov/cant-self-approve
Don’t let users self-approve broadcasts
2020-08-06 14:04:07 +01:00
Chris Hill-Scott
479406c02d Don’t let users self-approve broadcasts
At the moment they will get a ‘technical difficulties’ error if they
try.

We probably want to do something around letting people self-approve
broadcasts in trial mode, but for now just telling them they can’t is a
better experience than ‘technical difficulties’ (and will probably be
close to what they should see on a live service as well).
2020-08-05 16:01:21 +01:00
Tom Byers
cd398ab55c Merge pull request #3543 from alphagov/remove-code-supporting-old-permissions-form_fields
Revert support for old user permissions params
2020-08-05 15:51:28 +01:00
David McDonald
8b44919551 Merge pull request #3548 from alphagov/pyup-scheduled-update-2020-08-03
Scheduled weekly dependency update for week 31
2020-08-05 10:30:19 +01:00
Chris Hill-Scott
2cd6db6357 Merge pull request #3551 from alphagov/permssions-permissions
Fix typo on invite page
2020-08-05 09:21:40 +01:00
Chris Hill-Scott
cc9fecfaa0 Fix typo on invite page
There’s an _i_ missing from _Permssions_
2020-08-04 18:17:38 +01:00
Chris Hill-Scott
b31fb7de66 Merge pull request #3546 from alphagov/redis-cache-broadcast-message
Cache broadcast messages in Redis
2020-08-04 16:17:21 +01:00
Chris Hill-Scott
4d65b94c77 Fix HTML being escaped in preview of email subject
`EmailPreviewTemplate.subject` returns a string of HTML, with any
user-submitted HTML already escaped:
b5a61bfb7b/notifications_utils/template.py (L672)

What won’t be escaped is the HTML needed to redact the placeholders. We
generate this HTML so we know its safe, and doesn’t need to be escaped.
However when we pass it to Jinja, Jinja doesn’t know this, so will try
to escape it. This means users will see the raw HTML.

We can get around this by using Flask’s `Markup` class to tell Jinja
that the string is already sanitised and doesn’t need escaping again.

Text message templates don’t have this problem because they already
return `Markup`: b5a61bfb7b/notifications_utils/template.py (L288)

Letter templates don’t suffer from this problem (because they don’t
support redaction) but without making the same change they would still
double-escape ampersands, greater-than symbols, and so on.
2020-08-04 15:16:18 +01:00
Tom Byers
a74501f1d8 Merge pull request #3535 from alphagov/try-introducing-govuk-checkboxes-again
Try introducing govuk checkboxes again
2020-08-04 14:39:54 +01:00
David McDonald
b872db3032 freeze requirements 2020-08-04 12:13:35 +01:00
Chris Hill-Scott
63095f7a6c Merge pull request #3536 from alphagov/guest-list-endpoint
Use new guest list API URLs
2020-08-04 11:40:42 +01:00
Chris Hill-Scott
16563cb8e8 Merge pull request #3549 from alphagov/go-to-broadcast-once-created
Go to broadcast, not dashboard after submitting for approval
2020-08-04 11:40:34 +01:00
Chris Hill-Scott
3faf92bfef Go to broadcast, not dashboard after submitting
Once you’ve created a broadcast you’re taken back to the dashboard. This
feels too passive, and you might miss that the broadcast still needs
approval.

We should be much more explicit that you now need to find someone to
approve your broadcast. Taking someone directly to the page for a
broadcast lets us give more information about the status of the
broadcast and what the next steps should be.
2020-08-03 15:46:23 +01:00
pyup-bot
7eefa1f2ad Update gds-metrics from 0.2.2 to 0.2.4 2020-08-03 14:53:16 +01:00
pyup-bot
9ff4adda0f Update notifications-python-client from 5.6.0 to 5.7.0 2020-08-03 14:53:15 +01:00
pyup-bot
6da970fdca Update pyexcel from 0.6.2 to 0.6.3 2020-08-03 14:53:15 +01:00
Chris Hill-Scott
47a5c2abba Merge pull request #3540 from alphagov/search-whole-postal-address
Tell users that they can search whole postal address
2020-08-03 14:47:58 +01:00
Chris Hill-Scott
4bf4680031 Merge pull request #3547 from alphagov/broadcast-tour
Add a tour for users new to broadcast services
2020-08-03 14:21:03 +01:00
Chris Hill-Scott
19b42e3331 Add a tour for users new to broadcast services
This is an initial, prototype-quality attempt at introducing some kind
of tour for users new to broadcasting. A lot of the users we’re speaking
to don’t have a good concept of what broadcasting means, which is
causing usability problems down the line.

We did a similar thing in the early days of Notify to explain the
concept of message templates and personalisation.
2020-08-03 14:13:48 +01:00
Leo Hemsted
7e257f32ad Merge pull request #3545 from alphagov/notify-tags
add err msgs for letters with notify tags on pages 2+
2020-08-03 13:26:13 +01:00
Chris Hill-Scott
058553b6ee Cache broadcast messages in Redis
This should make the pages slightly quicker to load, because Redis will
return the JSON string faster than the API.

The only change that can happen to a broadcast which doesn’t go through
the admin app is a broadcast ending at its scheduled time. So this could
result in a cached broadcast having a status of `broadcasting` when it
had in fact finished. We already account for this here though:
b2b58ec044/app/models/broadcast_message.py (L89-L94)
2020-08-03 11:38:10 +01:00
Leo Hemsted
867ef30d18 add err msgs for letters with notify tags on pages 2+ 2020-07-31 18:31:26 +01:00
Tom Byers
468a43bd68 Revert support for old user permissions params
The fields used for user permissions on
permissions forms were changed as part of the work
converting the checkboxes to GOVUK Frontend.

This removes code added to protect against a
situation where the server-side app was running
this updated code but clients were POSTing from
pages that were not, and so sending the old HTTP
params.
2020-07-31 15:40:12 +01:00
Tom Byers
75bac87a4d Make permissions forms handle old/new params 2020-07-31 15:15:37 +01:00
Tom Byers
e3c434bb8f Change permissions tests to support old API
User permissions were handled by a group of
BooleanFields but introducing the new checkboxes
changed this to just one field that stores its
data in a list.

It was mentioned in a comment that there could be
a situation, when the instances roll, where clients
are using the old fields but POSTing to a server
running the new code.

https://github.com/alphagov/notifications-admin/pull/3535#discussion_r460872903

This introduces tests for that situation.
2020-07-31 15:15:26 +01:00
Tom Byers
f322229614 Change tests to check permissions_field name
A comment on this group of changes mentioned the
'name' attribute of checkboxes for the
permissions_field should be checked as well as the
'value' attribute:

https://github.com/alphagov/notifications-admin/pull/3535#discussion_r460869797

This adds checks to support that point.
2020-07-31 15:15:16 +01:00
Katie Smith
b2b58ec044 Merge pull request #3541 from alphagov/bump-eventlet
Bump eventlet
2020-07-31 10:50:51 +01:00
Katie Smith
a1b9644290 Bump eventlet
dnspython had been changed from 1.16.0 to 2.0.0 in a previous commit,
but this was not compatible with eventlet 0.25.2. This bumps eventlet to
a later version, which has the effect of downgrading dnspython again.
2020-07-31 10:38:44 +01:00
Tom Byers
e266b11ee2 Fix tests for pages using govukCheckboxField
These fields used to use govukCheckboxesField and
so stored their data in a list. They were since
migrated to govukCheckboxField, which extends
BooleanField and so keeps its data as a boolean
value.
2020-07-31 10:20:44 +01:00
Katie Smith
2307cb6815 Merge pull request #3539 from alphagov/more-letter-validation
Check for invalid characters in letter addresses
2020-07-31 09:10:44 +01:00
Katie Smith
ba5f7d7c36 Check for invalid chars in letter addresses
This now adds validation for invalid characters on the
LetterAddressForm for one off letters. It also adds a validation failed
message for uploaded letters, precompiled letters sent through the API,
and CSV rows with errors.
2020-07-31 08:51:07 +01:00
Katie Smith
0304edd7a2 Bump utils to 40.6.0
This brings in validation for invalid characters in address lines.
2020-07-31 08:51:07 +01:00
Chris Hill-Scott
3fbf966719 Display full address on the notifications page
This is what we do on the uploads page now. It makes it more obvious
why your search term has returned a certain result if you can see most
of the address, not just the first line.
2020-07-30 16:40:25 +01:00
Chris Hill-Scott
2789b6a596 Tell users that they can search whole postal address
We’re now normalising and storing the whole address in the
`normalised_to` field. Previously we were only storing the first line
of the address.

Enough time should now have passed that the field will have been
populated for all letters in the database.

Thus we can now tell users that it’s not just the first line they can
search by.
2020-07-30 16:20:19 +01:00
Chris Hill-Scott
52c9cf3e76 Merge pull request #3538 from alphagov/start-time-hint
Make start time explicit when previewing a broadcast
2020-07-29 09:15:21 +01:00
Katie Smith
257db79710 Merge pull request #3533 from alphagov/letter-page-error-bug
Include template values when calculating letter page count
2020-07-28 08:54:35 +01:00
Chris Hill-Scott
053ed96974 Make start time explicit when previewing a broadcast
We recently introduced a form control that lets user choose when a
broadcast ends.

Based on the most recent research participant, we think:
- there is a specific misunderstanding of what this control does
- there is a general low level of understanding of what a ‘broadcast’
  means

People will try to understand what a ‘broadcast’ is by using mental
models they have for other kinds of messaging, for example text
messages.

Other kinds of messaging are one-to-one, i.e. they go from a sender to a
recipient. They are not ongoing in any way.

Emails and texts are sent at a time (and for all practicable purposes
are received at that same time). So, when we present the user with
a form that controls time, they might well assume it controls the time
when the message will be sent.

This is a feature we offer for sending messages using a spreadsheet, and
that’s where we’ve borrowed this pattern from.

We reinforce this assumption with the labelling of the form control. By
front-loading it with the word ‘When’ we are playing to the users
confirmation bias, i.e. they are interpreting the meaning of the control
in a way that confirms their prior beliefs about how messaging works.

So this commit does two things:
- re-labels the form to front-load the word ‘End’ not ‘When’
- adds text to the page explaining when the broadcast will start, so
  there’s a chance of overriding that confirmation bias

If we can get users to go through this before sending a broadcast for
real, it could help them learn what a broadcast is, and how it differs
from sending text messages.
2020-07-27 17:33:34 +01:00
Katie Smith
716977fe75 Include template values when calculating letter page count
When sending a letter we check how many pages it has and this number
then determines how many PNG images we ask template preview for. When
calculating the page count, we were getting the page count for the
template as it comes from the database (so without any placeholders
filled in). But filling in placeholders in a letter may cause the number
of pages to change, which was the cause of the 'Letter does not have a
page x' errors we were seeing from template-preview.

Now, when we calculate the letter page count during sending, we take the
placeholders that have already been filled in into account.
2020-07-27 17:22:14 +01:00
Chris Hill-Scott
e0cb487093 Use new guest list API URLs
The API now[1] accepts requests on `…/guest-list` as well as
`…/whitelist`. This commit starts using the former, which means:
- the use of ‘whitelist’ is fully gone from the admin app
- the API can stop using it, at least in URLs

1. As of https://github.com/alphagov/notifications-api/pull/2928
2020-07-27 13:24:37 +01:00
Tom Byers
0d6ef2977d Merge pull request #3465 from alphagov/add-scroll-to-reveal-method
Add scroll to reveal element method
2020-07-24 14:21:15 +01:00
Tom Byers
ca9b8a8ca3 Add analytics error tracking to checkbox fields
The existing macros added data attributes to any
error message displayed which communicated the
error to Google Analytics (if the user had given
consent).

This re-implements that functionality.
2020-07-24 11:34:02 +01:00
Tom Byers
01f84d5443 Convert checkboxes for broadcast areas
Includes removal of MultiCheckboxField due to it
no longer being used elsewhere in this file.
2020-07-24 11:34:02 +01:00
Tom Byers
64cc9f2520 Make tests work with new template list HTML
Adds the extra text added to each checkbox label.
It's a copy of the text of the link in the same
list item which does add a lot of duplication to
the test data.

This reformats a lot of the test data, stacking it
to separate out the duplicate items.
2020-07-24 11:34:02 +01:00
Tom Byers
ee03753187 Make template-list checkbox label text match link
The checkboxes need an accessible name that
identifies the folder/template and this needs to
include their full path to avoid duplication.

There's a lot of debate about how to write out
breadcrumb/path syntax so this just puts all the
words together under the assumption that the
folder naming will describe the path (and to
introduce as little extra semantics as possible
to start with).
2020-07-24 11:34:02 +01:00
Tom Byers
0f9e4c813a Change HTML for template list items
Moves the link out of the label and increases
the hit-size for the checkbox. The intention is to
reduce the chance of clicking the wrong thing by
accident.

This includes a TODO in the checkboxes component
template code. The item meta needs to be
associated with the checkbox input by use of
`aria-describedby` but this needs changes in
govuk-frontend-jinja to happen.
2020-07-24 11:34:02 +01:00