Commit Graph

11797 Commits

Author SHA1 Message Date
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
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
Chris Hill-Scott
2446e97753 Revert "Reduce default broadcast expiry time" 2021-07-30 09:39:08 +01:00
Ben Thorner
0e2f41c38c Merge pull request #3976 from alphagov/eradicate-roles-178770155
Replace the term "role" everywhere
2021-07-28 13:03:05 +01:00
Pea Tyczynska
e1420e7ff7 Catch cancel_letter errors from API
When we catch such error, if the message is recognised,
show the message and redirect user to view_notification page.
2021-07-28 12:55:06 +01:00
Ben Thorner
354cd8bb16 Replace remaining uses of the term "role"
In one case I did this by refactoring the code to avoid the need
for the "role" variable in the first place.
2021-07-28 12:37:18 +01:00
Ben Thorner
dcfff87cc0 Continue to remove "roles" terminology
This renames the two functions we have to translate between UI and
DB permissions, as well as some of their associated variables to
make it clearer which kind of permission they contain.
2021-07-28 12:37:17 +01:00
Ben Thorner
ba9865e62e Start to remove use of the term "roles"
We don't use this term consistently and it's not defined anywhere.
Since most of the Admin app deals with user-facing permssions, it's
OK to just use the term "permissions". Where both types of permission
are present in the same file, we can more clearly distinguish them
as "UI permissions" and "DB permissions".
2021-07-28 12:37:16 +01:00
Ben Thorner
a38baa0bd8 Rename unclear "permissions" attributes
These are more than a list of permissions: each item includes the
label to use when displaying it as an option on a form. Switching
to a name that reflects how the attributes are used will help to
avoid confusion when we rename some of the other attributes in the
same file in later commits.
2021-07-28 12:37:15 +01:00
Ben Thorner
f5580b87dc Move tests to match where the code is located
These tests are unrelated to the others in test_permissions.py. We
should try and structure our tests the same as the code under test
so that it's clear where new tests should go.
2021-07-28 12:36:43 +01:00
Ben Thorner
1127a03c32 Move and rename roles_and_permissions.py
This file does not represent a model, but rather a set of utilities
that are specific to user permissions (vs. service permissions).
2021-07-28 12:36:40 +01:00
David McDonald
2dd48de1a7 Merge pull request #3981 from alphagov/single-quote-sms-sender
Add support for single quote in SMS sender name
2021-07-27 09:43:33 +01:00
David McDonald
a6cac27957 Allow straight single quote in sms sender names
This is so we can allow the sender name 'UC' for DWP.

Note, this is specifically only straight single quotes and not curly
quotes or double quotes. Curly quotes are not supported in the GSM
character set (https://en.wikipedia.org/wiki/GSM_03.38). There is
currently no defined user ask to support double quotes in sms sender
names.

I have tested this by sending a message through both Firetext and MMG to
make sure they both support the single quote character in SMS sender
names.

DWP also have had no particular issues using the SMS sender name with
their existing system in the past either.
2021-07-27 09:26:16 +01:00
Katie Smith
dd9d652fbf Merge pull request #3979 from alphagov/permissions-refactor
Stop checking for `send_messages` permission for broadcast pages
2021-07-26 15:20:11 +01:00
David McDonald
65bdc7f5a4 Refactor of test cases into parametrized tests
No reason this shouldn't be parametrized. It will be neater, more
extendable and give better error messages

No functionality change, however I did slightly adapt one or two of the
test cases (for example to change the 11 characters or fewer test to
test on the boundary with 12 characters rather than many more).
2021-07-26 14:33:54 +01:00
Katie Smith
5277f734d9 Test the POST .approve_broadcast_message explicitly in the code
Previously, to get the the `.approve_broadcast_message` endpoint, we
were issuing a POST request to `.view_current_broadcast`. The
`.view_current_broadcast` only has a GET endpoint defined for the
`/services/<uuid:service_id>/current-alerts/<uuid:broadcast_message_id>`
route, so the request would end up at the `.approve_broadcast_message`
which defines the POST endpoint for that path.

This changes the tests to POST directly to `.approve_broadcast_message`
to avoid confusion.
2021-07-26 13:59:36 +01:00
Katie Smith
a7a1172e22 Split out the tests for 'New alert' button on broadcast dashboards
The 'New alert' button was being tested in the same tests as the tests
for the page content for the broadcast dashboards. Now that you only see
the button if you have the `create_broadcasts` permission, this adds a
new test just for the button so that the test for the page content can
be used for both broadcast permissions.
2021-07-26 13:59:36 +01:00
Katie Smith
bb4cd1ca07 Remove unused fixtures and freeze_time from test_broadcast.py 2021-07-26 13:59:36 +01:00
Katie Smith
761af69a00 Remove active_user_broadcast_permissions fixture
This wasn't adding anything now that we have two new and more specific
fixtures, `active_user_create_broadcasts_permission` and
`active_user_approve_broadcasts_permission`, that can be used instead.

`manage_templates` has now been removed from the `create_broadcasts`
permission, so this also adjusts the fixture for a user who can create
broadcasts.
2021-07-26 13:58:39 +01:00
Katie Smith
93ce0d4977 Remove send_messages permission from broadcast template page
This permission can be removed from the check to see whether the "Get
ready to send" link displays for broadcasts.
2021-07-26 13:58:23 +01:00
Katie Smith
8b08661902 Remove check for send_messages permission from broadcast pages
The `send_messages` permission has been deprecated for use with
broadcast services, so we can drop support for it in the code. We
were supporting both the old permissions and new permissions
(`create_broadcasts` and `approve_broadcasts`) while we switched people
over.

This removes `send_messages` from the `user_has_permissions` decorator
around the broadcast routes and from the page to view a broadcast and
broadcast dashboards. We can now git rid of a lot of the parameterization
that was temporarily added to the tests.
2021-07-26 10:58:16 +01:00
Chris Hill-Scott
b5fa6aeb33 Merge pull request #3977 from alphagov/alerts-permissions-labelling
Let people ‘add’ templates separately from ‘creating’ alerts
2021-07-26 10:13:32 +01:00
Chris Hill-Scott
b71f0c6795 Disambiguate sent and created
At the moment we say that you either ‘add’ an alert or ‘send’ it.

This is confusing because:
- an alert isn’t received on people’s phones until it’s approved, so
  this is really when it is ‘sent’ conceptually
- an alert can be rejected before anyone receives it, so the UI can say
  an alert that no-one ever received was sent

This commit re-labels things so that the the first part of the process
is ‘creating’ the alert.

This makes all the permissions nice and distinct from each other. Adding
templates and adding alerts feel conceptually quite different things
(what are you adding the alert to?).
2021-07-23 10:07:05 +01:00