Commit Graph

11844 Commits

Author SHA1 Message Date
Ben Thorner
4bae4eec6c Start sending aggregate area names to API
The aggregate names don't need to be sorted, but it helps to do
this for the tests, since the implementation of sets may not be
stable between machines and lead to sporadic test failures.

I did also toy with sorting granular area names so they have a
similar ordering, but this would take them out-of-order with IDs
and really the important thing is that the ordering is stable.
2021-09-02 12:59:18 +01:00
Ben Thorner
a94291d5a4 Clarify comments for aggregation algorithm
In response to [1] and [2].

[1]: https://github.com/alphagov/notifications-admin/pull/4003#discussion_r695919270
[2]: https://github.com/alphagov/notifications-admin/pull/4003#discussion_r695920213
2021-09-02 12:59:17 +01:00
Ben Thorner
de804805ac Refactor logic to identify types of areas
I did consider whether to store this explicitly in the SQLite DB,
but this is less effort for now and we can always switch to that
more robust approach in future if we need to.
2021-09-02 12:59:16 +01:00
Ben Thorner
bcfa21428f Support aggregating local authority clusters
This applies some heuristics to try and keep the overall list of
areas short when many are selected in the same wider area.

Currently we only have relationship information between upper and
lower tier local authorities, so we can't / won't aggregate up to
Greater London (it's own special thing) or whole countries.
2021-09-02 12:59:13 +01:00
Ben Thorner
2d912cef42 Support area aggregation for custom polygons 2021-09-02 12:55:53 +01:00
Ben Thorner
a210d87dee Add function method to aggregate areas
This is standalone for now - we'll plumb it in later.
2021-09-02 12:55:52 +01:00
Ben Thorner
12978f0a9a Simplify creating BroadcastMessage instances
This avoids passing loads of unnecessary boilerplate values.
2021-09-02 12:55:51 +01:00
Ben Thorner
f96b75b401 Add method to get wards for custom polygon
This will be used as part of the area aggregation in the following
commits.
2021-09-02 12:55:47 +01:00
Ben Thorner
51b786e544 Merge pull request #4006 from alphagov/continue-areas-migration-178986763
Complete migration to new "areas" API format
2021-09-01 17:10:47 +01:00
karlchillmaid
c406f64bd3 Merge pull request #4008 from alphagov/update-service-name-advice
Update service name advice
2021-09-01 12:32:33 +01:00
karlchillmaid
9f302050c4 Add 'initialism' 2021-09-01 11:31:48 +01:00
karlchillmaid
e0617004f5 Add 'initialism' 2021-09-01 11:30:01 +01:00
Ben Thorner
cfdd244325 Complete migration to new "areas" API format
Depends on: https://github.com/alphagov/notifications-api/pull/3314

Previously:

- We introduced a new "areas_2" API field that's can
populate the "areas" column in the same way.

- We updated the Admin app to use the new field, so that
the old "areas" and "simple_polygons" API fields are unused.

- We repurposed the unused "areas" API field to use
the new "areas_2" format.

This PR:

- We can switch the Admin app back to the "areas" field,
but in the new format.

Future PRs:

- Remove support for the unused "areas_2" field (migration complete)
2021-08-27 14:34:49 +01:00
karlchillmaid
ef112df5eb Merge pull request #4005 from alphagov/update-security-page
Update Security page content
2021-08-27 14:30:46 +01:00
karlchillmaid
fd5a1d980b Fix link text, add security classification info 2021-08-27 13:58:10 +01:00
Ben Thorner
6c4340c5eb Merge pull request #4004 from alphagov/areas-refactor-178986763
Prepare to migrate to new format for "areas"
2021-08-27 11:49:07 +01:00
Ben Thorner
9667433b7e Add temporary command to migrate data for "areas"
This will be run with a CSV of all broadcast messages. Since very
few users are creating or updating broadcasts, it's highly unlikely
we'll encounter a race condition during the update.
2021-08-26 13:08:05 +01:00
Ben Thorner
39a1212508 Switch existing command to standard approach
This is the suggested approach in the documentation [1] and using
it makes it clearer what's going on and to add other commands with
arguments, which we'll do in the next commit.

[1]: https://flask.palletsprojects.com/en/2.0.x/cli/#custom-commands
2021-08-26 12:49:55 +01:00
Ben Thorner
7dbe3afa19 Include area names in data we send to API
These will be used as a fallback for display in gov.uk/alerts. It
also helps to have them in the DB to aid in quickly identifying
where an alert was sent, which is hard from the IDs.

We will look at backfilling names for past alerts in future work.
2021-08-26 12:49:54 +01:00
Ben Thorner
ae7f23d4cb DRY-up sending area updates to the API 2021-08-26 12:49:53 +01:00
Ben Thorner
73f31ef2fd DRY-up getting and setting area_ids
Previously we just held the new area_ids in memory. Setting them
on the object means we can reuse its functionality to get polygons
and also avoids confusion if in future we try to continue using
the object after calling "add_areas" or "remove_areas".
2021-08-26 12:49:52 +01:00
Ben Thorner
11cbee5843 Switch to using temporary "areas_2" API field
Depends on: https://github.com/alphagov/notifications-api/pull/3312

This is part of a multi-stage migration where we want to repurpose
the "areas" field in the existing API to something like "areas_2".
2021-08-26 11:01:56 +01:00
Ben Thorner
de9d1f991b Stop saying "areas" when we mean "area_ids"
"areas" normally means an instance of BroadcastArea or similar, so
we should be more accurate to avoid confusion.
2021-08-26 11:01:35 +01:00
Ben Thorner
bdf0fdbd5f Merge pull request #4002 from alphagov/refactor-area-methods-178986763
Initial refactors to support area aggregation
2021-08-24 14:25:54 +01:00
Chris Hill-Scott
5ba8387c6d Bump utils to 44.5.0
Brings in a new `intersects_with()` method of `Polygons` which will come
in handy.
2021-08-23 16:57:15 +01:00
Ben Thorner
427ac0c8c1 Fix misleading name for overlap method
Resolves: https://github.com/alphagov/notifications-admin/pull/3980#discussion_r692919874

Previously it was unclear what kinds of areas this method returned,
and whether there would be any duplicates (due to the hierarchy of
areas we work with). This clarifies that.

In addition, the areas returned may not overlap with the custom one
[1], so we should reword to avoid falsely implying that. We could do
the overlap check as part of the method as an alternative, but that
would create extra work when calculating the ratio of intersection.
We could always add "overlapping areas" as a complementary method to
this one in future.

[1]: https://github.com/alphagov/notifications-admin/pull/3980#discussion_r692919874
2021-08-23 16:56:47 +01:00
Ben Thorner
d2784d0d8a Rename "parents" methods to "ancestors"
Resolves: https://github.com/alphagov/notifications-admin/pull/3980#discussion_r694002952

A grandparent is not a parent, so the return value of these methods
were misleading. This makes it clearer.
2021-08-23 16:50:18 +01:00
Ben Thorner
1923c5edb1 Remove redundant 'filter' and return value
'None' is the implicit return value. Since the filter was operating
on a yield that never yield 'None', it was redundant.
2021-08-23 16:35:38 +01:00
Chris Hill-Scott
a50b77d52c Merge pull request #4000 from alphagov/email-validate-password-reset
Update `email_access_validated_at` as soon as a you click a fresh link
2021-08-19 15:40:17 +01:00
Chris Hill-Scott
5c1920fc20 Remove old method of updating email_access_validated_at
Previously we were passing a flag to the API which handled this. Now
we are doing it at the time of clicking the link, not at the time of
storing the new password. We don’t need to update the timestamp twice,
so this commit removes the code which tells the API to do it.
2021-08-19 11:14:47 +01:00
Chris Hill-Scott
8355abeaf2 Update email_access_validated_at on invite
Accepting an invite means that you’ve just clicked a link in your email
inbox. This shows that you have access to your email.

We can make a record of this, thereby extending the time before we ask
you to revalidate your email address.
2021-08-19 11:14:47 +01:00
Chris Hill-Scott
cb59413581 Update email_access_validated_at on link click
When someone uses a fresh password reset link they have proved that they
have access to their inbox.

At the moment, when revalidating a user’s email address we wait until
after they’ve put in the 2FA code before updating the timestamp which
records when they last validated their email address[1].

We can’t think of a good reason that we need the extra assurance of a
valid 2FA code to assert that the user has access to their email –
they’ve done that just by clicking the link. When the user clicks the
link we already update their failed login count before they 2fa. Think
it makes sense to handle `email_access_validated_at` then too.

As a bonus, the functional tests never go as far as getting a 2FA code
after a password reset[2], so the functional test user never gets its
timestamp updated. This causes the functional tests start failing after
90 days. By moving the update to this point we ensure that the
functional tests will keep passing indefinitely.

1. This code in the API (91542ad33e/app/dao/users_dao.py (L131))
   which is called by this code in the admin app (9ba37249a4/app/utils/login.py (L26))
2. 5837eb01dc/tests/functional/preview_and_dev/test_email_auth.py (L43-L46)
2021-08-19 11:14:47 +01:00
Chris Hill-Scott
ff12ba689d Merge pull request #3993 from alphagov/4-hours-expiry-test-channels
Expire test and operator alerts after 4 hours
2021-08-18 10:12:26 +01:00
Leo Hemsted
9ba37249a4 Merge pull request #3975 from alphagov/redirect
follow sign_in redirect even if you're already signed in
2021-08-17 14:58:12 +01:00
Leo Hemsted
71d3aa13d7 follow sign_in redirect even if you're already signed in 2021-08-17 14:44:09 +01:00
Chris Hill-Scott
4ead26c806 Merge pull request #3998 from alphagov/format-thousands-returned-letters
Format 1000s properly on returned letters pages
2021-08-17 09:59:04 +01:00
Katie Smith
2a0181d909 Merge pull request #3995 from alphagov/update-accessibility-statement
Update accessibility statement with new issues
2021-08-13 16:46:48 +01:00
karlchillmaid
7b49dbb236 Fix link markup 2021-08-13 16:29:55 +01:00
karlchillmaid
342e0e9d05 Update bullet formatting and content 2021-08-13 16:29:55 +01:00
karlchillmaid
1fa2d6fc58 Update last tested date 2021-08-13 16:29:55 +01:00
karlchillmaid
18312cfdaa Update success criterion and review date 2021-08-13 16:29:55 +01:00
karlchillmaid
ab132bab2a Update commitment dates 2021-08-13 16:29:55 +01:00
karlchillmaid
be0cc955bd Update commitment dates 2021-08-13 16:29:55 +01:00
karlchillmaid
c5f498f1e8 Add dates and update WCAG acronym 2021-08-13 16:29:54 +01:00
karlchillmaid
6650e1663c Update content 2021-08-13 16:29:54 +01:00
karlchillmaid
2bb460fff2 Update content 2021-08-13 16:29:54 +01:00
karlchillmaid
c111a68b57 Update content 2021-08-13 16:29:54 +01:00
Tom Byers
8e0bcc84dc Update accessibility statement with new issues
We had an audit in February of this year but did
not update the accessibility statement to reflect
the issues identified as fixed or to include new
issues it produced.

Some of the dates for fixed have also not been
updated for a long time.

This adds those changes, with placeholders for
dates assigned to each issue.

This content is now ready for review. The dates
will be assigned when that is complete.
2021-08-13 16:29:54 +01:00
Chris Hill-Scott
db0738ac39 Format 1000s properly on returned letters pages
Our style is to comma-separate numbers in the 1000s for easier reading.
2021-08-12 15:51:22 +01:00
Chris Hill-Scott
196da2b1b7 Reduce expiry time to 22 hours 30 minutes
Theoretically the maximum expiry time of a broadcast should be 24 hours.
If it goes over 24 hours there can be problems.

However we want to make it more conservative to mitigate two potential
issues:

1. The CBC has a repetition period (eg 60 seconds) and a count (eg
   1,440). If these were slightly innaccurate or generous it could take
   us over 24 hours. For this reason we should give ourselves half an
   hour of buffer.
2. It’s possibly that the CBC could interpret a UTC time as BST or vice
   versa. Until we’re sure that it’s using UTC everywhere, we need to
   remove another whole hour as buffer.

In total this means we remove 1 hour 30 minutes from 24 hours, giving an
expiry time of 22 hours 30 minutes.
2021-08-10 13:41:03 +01:00