Commit Graph

11818 Commits

Author SHA1 Message Date
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
Chris Hill-Scott
8ff7fecf40 Expire test and operator alerts after 4 hours
While testing alerts on these channels the MNOs sometimes need to
restart their CBCs to make sure everything is failing over properly.

If the CBC does not come back up, for whatever reason, then we are left
in a state where the alert can’t be cancelled.

To minimise the impact to the public in this scenario we should keep the
expiry time at 4 hours for alerts sent on test channels. We recently
increased it back up to 24 hours for all channels, so this in effect is
reverting that change for channels that won’t be used in a real
emergency.
2021-08-09 15:15:58 +01:00
Ben Thorner
bb414ee3b9 Merge pull request #3991 from alphagov/update-thanks-page-content
Update content
2021-08-06 16:50:38 +01:00
Chris Hill-Scott
d20bf0aeb4 Merge pull request #3957 from alphagov/make-calculating-overlaps-faster
Make calculating overlapping areas faster
2021-08-06 16:00:00 +01:00
Chris Hill-Scott
b273037462 Use str.join to build query
This avoids the nasty slice operator to trim the trailing comma.
2021-08-06 13:28:41 +01:00
Chris Hill-Scott
de364bba3c Make overlapping_areas a cached property
It’s quite expensive to calculate and there’s no guarantee we’ll only use it once.
2021-08-06 13:28:41 +01:00
Chris Hill-Scott
5e1b96a3a7 Remove argument unpacking from get_areas
Making it only callable in one way is just less stuff to understand.
2021-08-06 13:28:40 +01:00
Chris Hill-Scott
6c766c24b6 Ensure that phones are only counted once
The page which shows the count of phones does some logic based on how
close the ‘will get’ and ‘likely to get’ numbers are. This means it
accesses the `BroadcastMessage.count_of_phones` and
`BroadcastMessage.count_of_phones_likely` properties multiple times.

These properties are computed fresh every time, and are quite expensive
to compute. By caching them in memory we can cut the page load time
approximately in half.
2021-08-06 13:28:40 +01:00
Chris Hill-Scott
775954da9d Avoid doing a single SQL query per overlapping area
To count phones in a custom polygon we need to work out the percentage
of overlap with each known area. This means we need to get each known
area from the database to compare it.

At the moment we do this by running:
- one SQLite query to get the details of all matching areas
- a loop, which performs one SQLite query *per area* to get the polygons

This commit reduces the number of SQLite queries to one, which uses a
`JOIN` to get both the details of the areas and their polygons.

This gives a speed increase of about 25% for a big area like
Lincolnshire.
2021-08-06 13:28:40 +01:00
Chris Hill-Scott
e7ec77c5bb Make calculating overlapping areas faster
By using the simplified polygons instead of the full resolutions ones
we:
- query less data from SQLite
- pass less data around
- give Shapely a less complicated shape to do its calculations on

This makes it faster to calculate how much of each electoral ward a
custom area overlaps.

For the two areas in our tests:

Place represented by custom area | Before | After
---------------------------------|--------|--------
Bristol                          | 0.07s  | 0.02s
Skye                             | 0.02s  | 0.01s
2021-08-06 13:28:40 +01:00
Ben Thorner
2f2be65465 Fix tests to match content updates 2021-08-06 13:10:31 +01:00
karlchillmaid
c6c933dd4b Update content for clarity 2021-08-06 12:46:13 +01:00
karlchillmaid
7a42614e33 Update content
Update content so that it matches the promise on the Support page
2021-08-06 11:50:04 +01:00
Tom Byers
90fc55a28d Merge pull request #3990 from alphagov/fix-profile-links
Give user profile change links more context
2021-08-06 11:28:19 +01:00
Katie Smith
08084dfbd2 Merge pull request #3988 from alphagov/back-link-location
Move backlink out of `<main>`
2021-08-06 10:10:47 +01:00
Tom Byers
5e6c1cac38 Fix tests broken by changes 2021-08-05 15:45:57 +01:00
Tom Byers
8e7e072df9 Give user profile change links more context
They all currently say 'Change' which makes it
confusing when they are viewed out of their
context (ie. when all the links in the page are
listed out by a screen reader).

This gives them a suffix relating to the thing
they will change, like the links on the service
settings page.
2021-08-05 13:57:07 +01:00
Katie Smith
245d9ed75e Fix styling for platform admin template
The layout for the platform admin base template needed to be changed so
that the back link appears in the same place as before.

Previously, the left hand nav was inside `<main>`, but that did not need
to be and was inconsistent with other pages, so has been taken out.
2021-08-03 11:28:15 +01:00
Katie Smith
f1d9f2ab19 Remove back_link parameter from page_header macro 2021-08-03 11:28:15 +01:00
Katie Smith
0f0b8b8ae4 Move back link outside of main where it was used in the page header
The page_header macro includes an optional back link. Since the
page_header is always used inside `<main>`, where the back link should
not be, this stops setting the back link in the page header and instead
sets it in the new `backLink` block.
2021-08-03 11:28:15 +01:00
Katie Smith
1860b2b690 Move back link above main content for straightforward cases
This moves the back link to be above the `<main>` tag by making use of
the new `backLink` block. This doesn't change the pages which are using
a back link as part of the `page_header` macro yet.
2021-08-03 11:28:15 +01:00
Katie Smith
0b9f1053b3 Add backLink block to templates
This will be used to put the back link in, since it it is before the
`<main>` tag. We could have used the `beforeContent` block directly, but
that sometimes already has content in - this means it's not clear when
you also need to use `super()` inside the block and when you don't.
2021-08-03 11:28:15 +01:00
Katie Smith
c7c4c6543a Delete unused templates
service-set-broadcast-account-type.html stopped being used in a0f54539cc.
set-letter-contact-block.html stopped being used in 45697aac43
2021-08-03 11:28:15 +01:00
Pea Tyczynska
af6b1d38b5 Merge pull request #3984 from alphagov/handle-cancel-letter-errors-from-api
Catch cancel_letter errors from API
2021-08-03 11:05:46 +01:00
Ben Thorner
703516cbec Merge pull request #3987 from alphagov/update-sizewell-name-178774818
Rename demo area to match govuk-alerts
2021-08-03 10:21:25 +01:00
Ben Thorner
297ab3e5ae Rename demo area to match govuk-alerts
Relates to: https://github.com/alphagov/notifications-govuk-alerts/pull/152

I ran the "create-broadcast-areas-db.py" script to regenerate the
Sqlite DB. Existing alerts with the old naming still appear correctly,
and since we don't (yet) store this text in the DB, there's nothing
more to update.
2021-08-02 15:34:55 +01:00
Chris Hill-Scott
0363181dae Merge pull request #3985 from alphagov/revert-3800-reduce-default-broadcast-expiry
Revert "Reduce default broadcast expiry time"
2021-07-30 10:16:30 +01:00