Commit Graph

10086 Commits

Author SHA1 Message Date
karlchillmaid
d75da753e6 Merge pull request #3534 from alphagov/update-blog-link
Fix footer link to GOV.UK Notify blog
2020-07-23 17:07:21 +01:00
karlchillmaid
081d925cf6 Fix blog URL 2020-07-23 16:22:16 +01:00
Leo Hemsted
5af03607f0 Merge pull request #3532 from alphagov/broadcast-dashboard-refinements
Make live broadcasts feel more prominent on dashboard
2020-07-22 15:42:26 +01:00
Leo Hemsted
8f0c6e43c1 fix tests 2020-07-22 15:15:23 +01:00
Chris Hill-Scott
aed9bc3695 Add a ‘live broadcast’ indicator
We have a reckon that live broadcasts don’t feel prominent,
consequential or active enough on the dashboard.

This commit adds an animated component, similar to an ‘on air’ indicator
in a broadcast studio, or a ‘recording’ indicator on a video camera.

This is one option for addressing our reckon. We shouldn’t merge this
until we have a better understanding of the problem from another round
of user research.
2020-07-21 09:05:24 +01:00
Chris Hill-Scott
ad1fe752e7 Swap order of live and pending 2020-07-20 15:41:39 +01:00
Chris Hill-Scott
8e4d5c5fe4 Merge pull request #3530 from alphagov/confirm-cancel-broadcast
Add a confirmation step to cancelling a broadcast
2020-07-20 10:40:53 +01:00
Chris Hill-Scott
9958460ab3 Update tests for service permission
This commit makes the tests for the `broadcast` service permission more
robust by:
- adding coverage of endpoints that have been created since the test was
  first written
- checking that the endpoint also responds to a `post` request with a
  `403` (or `405` where it is a `get`-only endpoint)
2020-07-20 09:27:46 +01:00
Chris Hill-Scott
6704919a2d Add a confirmation step to cancelling a broadcast
It’s an irreversible action if you do click it, so it feels like an ‘Are
you sure?’ step is sensible. Follows the same pattern for deleting
templates, etc.
2020-07-20 09:27:44 +01:00
Chris Hill-Scott
4f859a69a6 Merge pull request #3527 from alphagov/broadcast-end-time
Let users choose when to end a broadcast
2020-07-17 10:43:10 +01:00
Chris Hill-Scott
2d7d800c64 Merge pull request #3528 from alphagov/fix-set-broadcast-permission
Fix setting of broadcast permission
2020-07-17 10:40:26 +01:00
Chris Hill-Scott
a1f063c9aa Merge pull request #3529 from alphagov/hint-status-pending-broadcast
Make the status text of pending broadcasts grey
2020-07-17 09:36:29 +01:00
Chris Hill-Scott
b3b2097556 Make the status text of pending broadcasts grey
Only live broadcasts have their status in black text. This is to
emphasise them. Lost this in a merge conflict somewhere.
2020-07-17 08:37:19 +01:00
Tom Byers
741ab9288f Add tests for 'data-show-now-as-default' on/off 2020-07-17 08:28:59 +01:00
Tom Byers
b5360c14cc Lowercase value of 'show-now-as-default'
To match the boolean value in JavaScript.
2020-07-17 08:28:59 +01:00
Tom Byers
e45bbcf99e Fix comparison of original categories with new
These tests make sure the sub-categories shown
when a category is selected are right but the
comparison looked for a direct match between the
labels for both types.

This looks for the category label in the
sub-category label instead, ie.

'Today at' in 'Today at 1pm'.

...instead of

'Today at' === 'Today at 1pm', which will always
fail.
2020-07-17 08:28:59 +01:00
Tom Byers
909f2d4678 Fix numbering on hours in radioSelect test 2020-07-17 08:28:59 +01:00
Tom Byers
636cb6825b Fix use of querySelector in radioSelect tests 2020-07-17 08:28:58 +01:00
Chris Hill-Scott
83156bd16e Let users choose when to end a broadcast
Different emergencies will need broadcasts to last for a variable amount
of time. We give users some control over this by letting them stop a
broadcast early. But we should also let them set a maximum broadcast
time, for:
- when the duration of the danger is known
- when the broadcast has been live long enough to alert everyone who
  needs to know about it

This code re-uses the pattern for scheduling jobs, which has some
constraints that are probably OK for now:
- end time is limited to an hour
- longest duration is 3 whole days (eg if you start broadcasting Friday
  you have the choice of Saturday, Sunday and all of Monday, up to
  midnight)
2020-07-17 08:23:10 +01:00
Chris Hill-Scott
ca292037e7 Merge pull request #3522 from alphagov/broadcast-approval
Add an approval loop for broadcasts
2020-07-17 08:18:34 +01:00
Chris Hill-Scott
03b4aabf5f Add a link to reject a broadcast
If a broadcast definitely shouldn’t go out (for example because it has a
spelling mistake or is going to the wrong areas) then we should have a
way of removing it. Once it’s removed no-one else can approve it, and it
isn’t cluttering up the dashboard.

This is a link (because it’s a secondary action) and red (because it’s
destructive, in that it’s throwing away someone’s work).
2020-07-17 08:07:44 +01:00
Chris Hill-Scott
a99b40304b Add button to approve broadcast
Since new broadcasts will go into `pending-approval`, we now need a way
of approving them.

This commit adds a button to this page to start (or approve) the
broadcast. This button is wrapped in a bordered box, to emphasise that
it’s something consequential.
2020-07-17 08:07:44 +01:00
Chris Hill-Scott
5b83db9768 Don’t start broadcasts immediately
We don’t want one person going full yolo and start broadcasting without
any oversight. This commit changes the flow so that the button on the
‘preview’ page puts the broadcast into `pending-approval`, rather than
directly into `broadcasting`.
2020-07-17 08:07:43 +01:00
Chris Hill-Scott
4b1e3ec504 Refactor broadcast message model
There was a lot of duplicate code here for updating the status and other
properties of a broadcast.

This commit abstracts them into reusable methods. They’re named with an
underscore to suggest that they shouldn’t be used externally.
2020-07-17 08:07:42 +01:00
Chris Hill-Scott
73c5aa9bb7 Add page for broadcast in pending state
Since we’ll be linking to pending broadcasts from the dashboard, the
page needs to be ready to display them.

Pending broadcasts lack a few bits of information that live or previous
broadcasts have (like the start date for example). So this commit hides
the code that displays those bits of information.
2020-07-17 08:07:41 +01:00
Chris Hill-Scott
c270688fe4 Show pending broadcasts on dashboard
When we have an approval flow, `pending-approval` will be the state a
broadcast is in between being a draft and broadcasting.

This means it is the earliest stage at which a broadcast can appear on
the dashboard, so this commit adds a new section at the top of the
dashboard to display these broadcasts (since the dashboard is in a
reverse chronological order).

Rather than displaying the scheduled time, the extra information shown
is the person who drafted the broadcast, since I reckon you’ll be coming
to this page because they’ve asked you to approve their broadcast.
2020-07-17 08:07:40 +01:00
Chris Hill-Scott
e29a477eb1 Fix setting of broadcast permission
This was broken because current_service doesn’t update itself after
calling the `update` method of the API. So we thought we were changing
the permissions like this:
```
{'email', 'sms', 'letter'}
{'email', 'sms', 'letter', 'broadcast'}
{'sms', 'letter', 'broadcast'}
{'letter', 'broadcast'}
{'broadcast'}
```

But actually we were doing this:
```
{'email', 'sms', 'letter'}
{'email', 'sms', 'letter', 'broadcast'}
{'sms', 'letter'}
{'email', 'letter'}
{'email', 'sms'}
```

This commit changes the code to update the permissions like this:
```
{'email', 'sms', 'letter'}
{'broadcast'}
```

It does so by adding a new method to the service model which changes all
the permissions in one API call, and updates the tests to mock the
underlying API call, not the method on the model.
2020-07-16 19:44:20 +01:00
Chris Hill-Scott
7b00e3c5b9 Merge pull request #3523 from alphagov/broadcast-dashboard-ajax
Make the broadcast dashboard update via AJAX
2020-07-16 16:53:01 +01:00
Chris Hill-Scott
352388e92a Fix keyline width on empty dashboard tables
The styling of the empty message seems to conflict with the hard-coded
widths added by the `dashboard-table` class. So we should only add the
`dashboard-table` class when there is content we need to control the
width of.
2020-07-16 16:47:16 +01:00
Chris Hill-Scott
5229373341 Make the broadcast dashboard update via AJAX
Same technique as we use for other pages that update via AJAX.

I’ve split the page up into separate chunks because the DiffDOM library
we use finds it easier to work out what’s changed when there are fewer
elements/a shallower tree.
2020-07-16 16:47:08 +01:00
Chris Hill-Scott
414e4b5834 Merge pull request #3520 from alphagov/broadcast-user-permissions
Make user permissions make sense for services with the broadcast permission
2020-07-16 14:59:57 +01:00
Katie Smith
da1a280f7c Merge pull request #3515 from alphagov/update-usage-page-2
Update usage page to display international letters
2020-07-15 14:21:22 +01:00
Katie Smith
756a17f8db Add filter for formatting a number as currency
This is used on the usage page, but is likely to become useful in other
places now that letter rates can be greater than £1.
2020-07-15 14:09:49 +01:00
Katie Smith
355e981028 Show international letters on the usage page
The api returns letter details split by postage, so international
letters are returned with a postage of `europe` or `rest-of-world` not
`international` and these rows need to be added together when the rate
is the same before they are displayed on the usage page.

To do this, we need to replace the postage of `europe` and
`rest-of-world` with `international`. The data then needs to be sorted
by postage and rate before the letter units for rows which are
international and have the same rate are added together.
2020-07-15 14:09:49 +01:00
Katie Smith
2a6691f665 Refactor letters code for usage page
No functional changes, but this changes the letter details that are
used for the usage page from a tuple to a named tuple since this makes
it easier to understand.
2020-07-15 14:09:49 +01:00
Tom Byers
0f29b3d64c Merge pull request #3526 from alphagov/revert-3476-introduce-govuk-checkboxes
Revert "Re-introduce govuk checkboxes"
2020-07-15 14:03:04 +01:00
Tom Byers
dfcddb757e Revert "Re-introduce govuk checkboxes" 2020-07-15 13:41:34 +01:00
Tom Byers
86f70ae9fa Merge pull request #3476 from alphagov/introduce-govuk-checkboxes
Re-introduce govuk checkboxes
2020-07-15 13:14:19 +01:00
Chris Hill-Scott
cc925238c7 Merge pull request #3518 from alphagov/view-broadcast-page
Add a page to view a single broadcast
2020-07-15 11:42:45 +01:00
Chris Hill-Scott
da29d35482 Merge pull request #3524 from alphagov/no-templates-message-broadcast
Add ‘no templates’ message for broadcast services
2020-07-15 11:37:56 +01:00
Chris Hill-Scott
de333a7d83 Merge pull request #3519 from alphagov/broadcast-settings
Remove emails, text messages and letter permissions from broadcast services
2020-07-15 09:38:59 +01:00
Chris Hill-Scott
c20958ef34 Clean up test formatting
Ensures that:
- test name reflects what it now does
- only one parameter per line
- argument order in parameterize matches argument order in function
  definition
2020-07-15 09:16:06 +01:00
Chris Hill-Scott
fd05bed600 Remove references to email, text and letters in trial mode
We don’t know what trial mode for broadcast services is going to look
like, but it’s not going to involve sending emails.
2020-07-15 09:14:56 +01:00
Chris Hill-Scott
89dd64cbad Don’t let broadcast re-enable other channels
When a service is switched over to broadcast it has the email, text
message and letter permissions removed. And the links to switch these
settings back on are hidden.

This commit ensures that even if the user manually goes to the URLs for
these pages, they still won’t be able to switch the other channels back
on.
2020-07-15 09:13:46 +01:00
karlchillmaid
aab8e1bb6e Merge pull request #3525 from alphagov/update-roadmap
Update road map
2020-07-14 17:29:02 +01:00
karlchillmaid
62021c0d4d Remove comment-out 2020-07-14 17:20:08 +01:00
karlchillmaid
b689db6cd6 Remove Q1 – move letters to Q2 – commented out 2020-07-14 17:15:49 +01:00
Chris Hill-Scott
9dfa48cfdd Don’t treat letters as a special case
This conditional comes from before we launched the letters feature.
Since we were only giving the letters permission to teams that we were
inviting, we didn’t want to confuse new users by mentioning letters.

Nowadays all new services will have the letters permission, so this
check is redundant.
2020-07-14 15:00:57 +01:00
Chris Hill-Scott
008e4befb4 Add ‘no templates’ message for broadcast services
This shouldn’t talk about emails, text messages or letters.
2020-07-14 14:59:46 +01:00
Chris Hill-Scott
41624295c9 Refactor conditional inside paragraph
This will make it easier to add more branches later.
2020-07-14 14:58:06 +01:00