Commit Graph

10222 Commits

Author SHA1 Message Date
Leo Hemsted
07cd014c3d Merge pull request #3573 from alphagov/nhs-scot
Add nhs.scot
2020-08-14 11:38:59 +01:00
Leo Hemsted
1f4cb25a64 Add nhs.scot
some scottish nhs domains are migrating from nsh.net to nhs.scot
2020-08-14 11:29:38 +01:00
Chris Hill-Scott
04c0c6422f Merge pull request #3568 from alphagov/fix-live-search-broadcast
Fix live search when selecting broadcast sub areas
2020-08-14 10:25:34 +01:00
Chris Hill-Scott
24e54a9345 Merge pull request #3572 from alphagov/rationalise-libraries
Rationalise broadcast libraries into one for national and one for local areas
2020-08-14 09:28:56 +01:00
Chris Hill-Scott
1c74d0798a Add singular descriptions for libraries
This lets us write nice interface copy like ‘Choose a local authority
from the local authorities library’.
2020-08-13 17:54:46 +01:00
Chris Hill-Scott
72f5dcb91f Remove the counties and unitary authorities library
It’s been superceded by the ‘Local’ library (formerly ‘Electoral wards
in the United Kingdom’).

The latter is better because:
- it’s covers all 4 nations, not just England and Wales
- it has electoral wards as well as local authorities which group them,
  so there’s more flexibility when choosing an area to broadcast to
2020-08-13 17:54:37 +01:00
Chris Hill-Scott
be16c0187f Rename electoral wards to local areas
We’ve observed people using ‘national’ and ‘local’ during user research.
It has less tongue-twisting ambiguity than county vs country.

But we think that maybe just getting rid of ‘counties’ is enough to
disambiguate them. So this commit just takes the ‘local’ concept.

This commit also gives the libraries and areas new IDs, which means if
we want to rename them in the future it won’t be a breaking change.
2020-08-13 17:54:28 +01:00
Chris Hill-Scott
76a00c9b61 Merge pull request #3565 from alphagov/polygon-overspill
Show indication of how a broadcast will overspill the selected area
2020-08-13 16:37:52 +01:00
Tom Byers
5220e1fbcb Merge pull request #3571 from alphagov/fix-fix-for-pill-spacing
Replace horizontal padding on pill items
2020-08-13 12:47:39 +01:00
Tom Byers
661c8c130c Replace horizontal padding on pill items
If the text isn't centrally aligned, it is needed.
2020-08-13 11:58:35 +01:00
Chris Hill-Scott
969e7a6dbd Show how a broadcast will overspill selected area
Broadcasting is not a precise technology, because:
- cell towers are directional
- their range varies depending on whether they are 2, 3, 4, or 5G
  (the higher the bandwidth the shorter the range)
- in urban areas the towers are more densely packed, so a phone is
  likely to have a greater choice of tower to connect to, and will
  favour a closer one (which has a stronger signal)
- topography and even weather can affect the range of a tower

So it’s good for us to visually indicate that the broadcast is not as
precise as the boundaries of the area, because it gives the person
sending the message an indication of how the technology works.

At the same time we have a restriction on the number of polygons we
think and area can have, so we’ve done some work to make versions of
polygons which are simplified and buffered (see
https://github.com/alphagov/notifications-utils/pull/769 for context).

Serendipitously, the simplified and buffered polygons are larger and
smoother than the detailed polygons we’ve got from the GeoJSON files. So
they naturally give the impression of covering an area which is wider
and less precise.

So this commit takes those simple polygons and uses them to render the
blue fill. This makes the blue fill extend outside the black stroke,
which is still using the detailed polygons direct from the GeoJSON.
2020-08-13 11:20:49 +01:00
Chris Hill-Scott
513d11eb98 Merge pull request #3562 from alphagov/fix-pill-spacing
Remove horizontal padding for pill items
2020-08-13 11:19:55 +01:00
Chris Hill-Scott
525d6338d2 Merge pull request #3567 from alphagov/bump-to-41
deps: bump notifications-utils to 41
2020-08-13 11:19:50 +01:00
Chris Hill-Scott
f625853388 Merge pull request #3569 from alphagov/remove-regions
Remove ‘Regions of England’ library
2020-08-13 11:19:42 +01:00
Chris Hill-Scott
8ef1e98745 Remove ‘Regions of England’ library
It made for a good early demo to show how we could have different
libraries, but we’d don’t think there’s a strong user need for being
able to broadcast to a region of England.

Regions also have the problem that:
- they are ambiguous – both England and Scotland have a region called
  ‘South east’
- Northern Ireland doesn’t have formal regions

This commit removes the regions library.
2020-08-12 18:03:50 +01:00
Chris Hill-Scott
a85134ee22 Merge pull request #3563 from alphagov/better-library-examples
Improve examples given for broadcast area libraries
2020-08-12 16:50:14 +01:00
Chris Hill-Scott
4242078885 Always show 4 items in the example list
If a library has lots of items then the first 3 should be shown, with
a count of how many more there are, for a total of 4 list items:
> a, b, c, and 23 more

If the library only has 4 items then all 4 should be shown, with
consistent use of conjunction and Oxford comma[1]:
> a, b, c, and d

This keeps the lengths of the examples nice and consistent.

1. We use an Oxford comma because it helps disambiguate when an area
itself has a comma or ‘and’ in it, for example ‘Armagh City, Banbridge
and Craigavon’
2020-08-12 16:34:17 +01:00
Chris Hill-Scott
dfa2ae0ced Order areas by name in examples
When you click through to the page for a library you see the available
areas in alphabetical order. The examples given for each library should
match this.
2020-08-12 16:34:17 +01:00
Chris Hill-Scott
53fd5b8869 Exclude grouped areas from examples
The given examples should match the choices offered when you visit the
next page. The choices offered on the next page are either the areas
(when a library is not grouped) or the groups (when a library is
grouped).

This commit makes the examples match the choices by excluding sub-areas,
ie those that have a grouping ID.
2020-08-12 16:34:17 +01:00
Chris Hill-Scott
40dacdeac9 Fix live search when selecting broadcast sub areas
It was targeting the wrong element because it hadn’t been updated to
reflect that we’re now using the Design System checkboxes.
2020-08-12 16:33:00 +01:00
Toby Lorne
4ba157ae8a deps: bump notifications-utils to 41
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
2020-08-12 16:11:38 +01:00
Chris Hill-Scott
781847d32c Merge pull request #3557 from alphagov/view-only-broadcast-page
Let users without `send_messages` view broadcasts
2020-08-12 15:16:39 +01:00
Tom Byers
222bb864bc Remove horizontal padding for pill items
This gives the contents of each item more space
which is useful on smaller screens or at higher
zoom levels.

Each item still has a 2px border so is prevented
from its contents touching those of the other
items. They are also flex-items, set to occupy a
quarter of the available space so will removing
this padding will not effect their width.
2020-08-12 11:32:55 +01:00
Chris Hill-Scott
0b206e3c0f Merge pull request #3561 from alphagov/optimise-broadcast
Optimise broadcast area code for fast page loads
2020-08-12 11:32:13 +01:00
Chris Hill-Scott
8d74e9c08d Store names and IDs of areas in memory
Now that the data needed to create a `BroadcastArea` is pretty
lightweight because it doesn’t include the GeoJSON we can go back to
putting it in memory when we start up the app, to make the pages load
really fast.

Rough estimate for the size of this dataset:
> 10,000 areas
> Average length of area name = 20 characters
> Average length of area id = 20 characters
> Size of one area in bytes = 20 + 20 = 40
> Size of dataset = 40 * 10,000 = 400,000 bytes = 400kb
2020-08-12 10:45:44 +01:00
Chris Hill-Scott
6c21a1732c Refactor to assign directly
There’s no need for an intermediate variable here, and it’s confusing
having two properties containing the same data.
2020-08-12 10:45:14 +01:00
Chris Hill-Scott
f96c43f5bc Store GeoJSON in a separate table
I think that even with good indexes, querying the area names from one
table is always going to be slow because there’s so much GeoJSON to scan
past.

This commit splits the data into two tables, one for the names and
grouping IDs and one for the blobs of GeoJSON. So for most pages the app
will never even be looking at the table where the GeoJSON is held.

I don’t know if this is a proper, normalised way of structuring the
data, but it does go brrr.
2020-08-12 10:43:01 +01:00
Chris Hill-Scott
e267e3d9f1 Refactor to use .query
All the other methods of this class call through to query, we can make
this code clearer by making `get_areas` do the same.
2020-08-12 10:42:28 +01:00
Chris Hill-Scott
adad27dadb Lazy load feature from the SQLite database
Rather than querying all the features whenever we look up area(s) let’s
only get them when we need them.

The features are really big blobs of data to pass around, so there’s a
significant performance gain to be had from doing this.
2020-08-12 10:40:27 +01:00
Chris Hill-Scott
3f9e49603d Merge pull request #3544 from alphagov/choose-electoral-ward
Let users select specific electoral wards in a local authority to broadcast to
2020-08-12 08:48:13 +01:00
Chris Hill-Scott
e47dbc0caa Add tests to check permission-restricted broadcast pages
Some pages should only be shown to users who have permission to send or
approve broadcasts. This commit adds a test to ensure that this is true,
and that we don’t accidentally regress the checks for this permission.
2020-08-12 08:19:51 +01:00
Chris Hill-Scott
78c88530b5 Let users without send_messages view broadcasts
At the moment viewing a broadcast is limited to those users who have
the `send_messages` permission.

This doesn’t match how we describe the permissions on the team members
page

This commit makes it so that any team member can see a broadcast that’s
in any state other than `draft`.
2020-08-12 08:19:49 +01:00
Chris Hill-Scott
8570901731 Let users select electoral wards of local authorities
If a library has groups, we should show a link instead of selecting the
group directly.

Then we can give the user the choice of selecting the whole of that
group, or specific areas within the group.

For now the only libraries we have with groups are local authorities,
which group electoral wards.
2020-08-11 17:38:15 +01:00
David McDonald
38953d1c28 Merge pull request #3560 from alphagov/turn-redis-back-on
Turn redis back on
2020-08-11 15:40:26 +01:00
David McDonald
2aaca11f8b Turn redis back on 2020-08-11 14:26:12 +01:00
David McDonald
32cc168c23 Merge pull request #3556 from alphagov/turn-redis-off
Turn off redis in all environments for rotation
2020-08-11 14:25:30 +01:00
Chris Hill-Scott
0ce64bcfde Merge pull request #3553 from alphagov/move-broadcast-areas-into-admin
Move broadcast areas into admin
2020-08-11 13:25:21 +01:00
Chris Hill-Scott
ac470ff350 Merge pull request #3559 from alphagov/hidden-email-on-register
Put hidden email field on register from invite page
2020-08-11 13:18:22 +01:00
Toby Lorne
b0ff2d41c5 broadcast-areas: examples are deterministic
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
2020-08-11 12:04:02 +01:00
Chris Hill-Scott
cf999b5d8e Add inline comment explaining presence of field 2020-08-11 11:26:31 +01:00
Chris Hill-Scott
b0fc1cd271 Make test name more explicit 2020-08-11 11:22:59 +01:00
Toby Lorne
73e68c355b broadcast-areas: include electoral wards
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
2020-08-10 18:09:15 +01:00
Toby Lorne
6649d0ac70 broadcast-areas: use area ids in tests
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
2020-08-10 18:09:15 +01:00
Chris Hill-Scott
834b0fc3d5 Put hidden email field on register from invite page
Password managers will try to guess what they should save as a username
by looking at the fields on the page where you set up your password.

When registering from an invite the email address (what we use as a
username) is predefined, and only shown on the page as text, not an
input.

This commit also adds a hidden input field for password managers to pick
up.

Adapted from: https://github.com/UKGovernmentBEIS/beis-opss-psd/blob/master/app/views/users/complete_registration.html.erb#L29-L36
2020-08-10 15:59:27 +01:00
Toby Lorne
8c3a8ecd04 broadcast-areas: view test does not assert order
the descriptions are liable to change esp for wards

Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
2020-08-10 13:04:03 +01:00
Toby Lorne
7a1b80e533 broadcast-areas: sort imports
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
2020-08-10 12:50:22 +01:00
Toby Lorne
698e9816ec models: use broadcast areas from admin package
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
2020-08-10 12:50:22 +01:00
Toby Lorne
74b83ffa8b broadcast-areas: vendor areas sqlite3 db
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
2020-08-10 12:50:22 +01:00
Toby Lorne
488a5440cd broadcast-areas: move broadcast areas into app
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
2020-08-10 12:50:20 +01:00
Toby Lorne
3243faa9a9 broadcast-areas: import LAs to wards dataset groups
instead of our shonky groupings

Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
2020-08-10 12:50:18 +01:00