Commit Graph

3784 Commits

Author SHA1 Message Date
Chris Hill-Scott
6c8bfdc5b0 Refactor failed login count
We don’t vary this between different environments so it doesn’t need to
be in the config.

I was trying to look up what this value was and found it a bit confusing
that it was spread across multiple places.
2021-03-19 15:20:11 +00:00
Leo Hemsted
62ce3c0696 Merge pull request #3842 from alphagov/remove-last-of-the-backwards-compat-invite-stuff
Remove last of the backwards compat invite stuff
2021-03-18 16:46:01 +00:00
Chris Hill-Scott
2a7f972a8a Merge pull request #3821 from alphagov/find-services-by-id
Support service IDs in ‘find services by name’
2021-03-18 13:16:36 +00:00
Ben Thorner
b5018725a1 Merge pull request #3819 from alphagov/simplify-nav-excludes
Simplify tests for excluded navigation endpoints
2021-03-18 12:25:24 +00:00
Katie Smith
776e24a215 Merge pull request #3840 from alphagov/accounts-page-fix
Fix /accounts page to only show trial services once
2021-03-17 15:29:07 +00:00
Leo Hemsted
0d350bdaf8 remove invited_user from session entirely
now that we no longer set it since
https://github.com/alphagov/notifications-admin/pull/3841 was merged, we
don't need to remove it either. And we can remove checks that expect it
when cleaning up the session. And the unit tests that make sure we
ignore it if it's in the session.

So long, session['invited_user'] and session['invited_org_user']!
2021-03-17 12:27:26 +00:00
Leo Hemsted
fb1345494c Merge pull request #3841 from alphagov/remove-old-invite-stuff
stop putting invite user objects in the session
2021-03-17 12:27:04 +00:00
Ben Thorner
08cb4a2576 Simplify tests for excluded navigation endpoints
Previously each navigation class had a list of endpoint to "exclude",
which was only used in tests to ensure that all endpoints in the app
were covered: either they are present in navigation, or excluded.

However, over time the "exclude" lists have grown long and repetitive,
and maintaining each of them individually adds extra work [1][2]. This
switches to a more DRY approach, where the list of excluded endpoints
is defined once, close to the single point of use in the test.

Note the resulting test is _slightly_ less prescriptive, as it will now
pass if an endpoint exist one in navigation, even if it should also
exist in another. This seems a reasonable compromise.

[1]: https://github.com/alphagov/notifications-admin/pull/3788/files#r572809972
[2]: https://github.com/alphagov/notifications-admin/pull/3794/files#diff-39387df3a9f89b313976957e7b5457be20deab1017b2d895541b142b957f1972
2021-03-17 12:06:27 +00:00
Leo Hemsted
8a2fec6f18 stop putting invite user objects in the session
the invited_user objects can be arbitrarily large, and when we put them
in the session we risk going over the session cookie's 4kb size limit.
since https://github.com/alphagov/notifications-admin/pull/3827 was
merged, we store the user id in the session. Now that's been live for a
day or two we can safely stop putting the rich object in the session.

Needed to change a bunch of tests for this to make sure appropriate
mocks were set. Also some tests were accidentally re-using fake_uuid.

Still pop the object when cleaning up sessions. We'll need to remove
that in a future PR.
2021-03-16 18:14:04 +00:00
Katie Smith
a33b6e0a0d Fix /accounts page to only show trial services once
The `/accounts` page was listing trial mode services twice if a user
belonged to an org. They were shown under both the 'Live services' and
'Trial mode services' sections. After this change, 'Live services' will
show all live services (whether or not they belong to an org) and 'Trial
mode services' will show all trial mode services. If a user belongs to an
org, they will also see the summary of how many services per org at the
top of the page.

A couple of services in tests were renamed for clarity.
2021-03-16 15:34:35 +00:00
Chris Hill-Scott
01c651d224 Merge pull request #3836 from alphagov/remove-performance-platform-report
Remove performance platform report
2021-03-16 10:19:28 +00:00
Chris Hill-Scott
7ee9b46744 Merge pull request #3837 from alphagov/fix-psort-order-performance-page
Fix sort order on performance page
2021-03-16 10:19:23 +00:00
Leo Hemsted
dc02d036f1 Merge pull request #3827 from alphagov/invited-user-id
Invited user
2021-03-15 13:42:16 +00:00
Leo Hemsted
bf979128ab use new check api endpoints for validating invite tokens
added in https://github.com/alphagov/notifications-api/pull/3171
2021-03-15 12:22:00 +00:00
Leo Hemsted
45297eae43 store invited user ids in session
same as the invited org user ids in the previous commit
2021-03-15 12:21:58 +00:00
Chris Hill-Scott
c8943cec8b Report performance platform report
We used to upload this to performance platform to show the list of
services and organisations.

There is no longer a performance platform to upload this file to.
2021-03-15 10:21:36 +00:00
Chris Hill-Scott
8926f3fca6 Fix sort order on performance page
This commit makes both the tables sort in reverse chronological order.
2021-03-15 10:05:46 +00:00
Chris Hill-Scott
3ea9cba0bc Fix bug when live services have no organisation
The performance page expects all live services to have an organisation.
This should be true on production, but it isn’t always the case in
other environments.

When the organisation name is `None`, the frontend can’t sort the list
of organisations alphabetically and so raises an exception.
2021-03-15 09:42:06 +00:00
Chris Hill-Scott
7583c8d9fa Remove redundant hidden H3s
This commit replaces the H3s which only repeated information with some
hidden text that will make it read nicer for screenreaders.
2021-03-12 17:19:50 +00:00
Chris Hill-Scott
f7989b84cb Add captions to tables
Co-authored-by: Tom Byers <tombaromba@gmail.com>
2021-03-12 17:08:49 +00:00
Leo Hemsted
6d62c9ba36 store invited org user ids in session
first of a two step process to remove invited user objects from the
session. we're removing them because they're of variable size, and with
a lot of folder permissions they can cause the session to exceed the 4kb
cookie size limit and not save properly.

this commit looks at invited org users only.

in this step, start saving the invited org user's id to the
session alongside the session object. Then, if the invited_org_user_id
is present in the next step of the invite flow, fetch the user object
from the API instead of from the session. If it's not present (due to a
session set by an older instance of the admin app), then just use the
old code to get the entire object out of the session.

For invites where the user is small enough to persist to the cookie,
this will still save both the old and the new way, but will always make
an extra check to the API, I think this minor performance hit is totally
fine. For invites where the user is too big to persist, they'll still
fail for now, and will need to wait until the next PR comes along and
stops saving the large invited user object to the session entirely.
2021-03-12 16:36:02 +00:00
Leo Hemsted
c89be0079a rename get_invited_user funcs
make it clear they're expecting a service/org id
2021-03-12 15:59:32 +00:00
Chris Hill-Scott
67316df3aa Repoint footer and homepage links
Performance Platform is going away at 10am on Monday, so let’s point to
our Performance Page instead.
2021-03-12 14:44:49 +00:00
Chris Hill-Scott
4d0264d196 Switch org and service order on home page
This matches what’s on the performance page – orgs on the left, services
on the right.
2021-03-12 14:44:41 +00:00
Chris Hill-Scott
5fa6639b52 Add count of orgs and services
This uses the existing endpoint so it matches what’s on the homepage.
It will be more up-to-date than the list of services, but no-one’s going
to be adding things up to check they match exactly.
2021-03-12 14:44:32 +00:00
Chris Hill-Scott
8106d6fdf2 Limit data to last 7 days
Otherwise the page gets really long. Also matches what we have on our
dashboards by default.
2021-03-12 14:44:24 +00:00
Chris Hill-Scott
c3699e0e35 Format numbers as millions or billions
This matches the existing performance platform page, and I think is a
bit easier to read for high-level numbers where you don’t need to see
that they’re changing second-by-second.
2021-03-12 14:44:15 +00:00
Chris Hill-Scott
646075f61f Put some stuff on the page
This basically copies the same sections from the existing performance
platform page, with the frontend cobbled together from our existing
patterns.
2021-03-12 14:44:06 +00:00
Chris Hill-Scott
545f933e37 Cache the JSON in Redis
The endpoints are probably fast enough, but it seems risky to have a
public URL which causes a new query every time the page is loaded.
2021-03-12 14:43:58 +00:00
Chris Hill-Scott
25a6788d66 Use arguments rather than passing around a dict
This makes it harder to write code which will pass tests but fail in
real life.
2021-03-12 14:43:50 +00:00
Chris Hill-Scott
fce4082fff Rename to performance
This is consistent with the old performance platform URLs, which were
gov.uk/performance, and others that we have like /pricing and /features
2021-03-12 13:56:21 +00:00
Rebecca Law
3ca2840652 Rename to performance-dashboard 2021-03-12 11:17:51 +00:00
Rebecca Law
042527e74c Start to build a page to performance platform page. 2021-03-12 11:17:44 +00:00
Chris Hill-Scott
79bbd0fd98 Don’t show future financal years on org page
There’s no useful information in the page for the future financial year
because there’s no way for any of the services to have yet used
anything.

Changes this matches the change we made to the service usage page in
https://github.com/alphagov/notifications-admin/pull/3439/files
2021-03-10 15:39:06 +00:00
Chris Hill-Scott
19488aad97 Merge pull request #3826 from alphagov/add-new-rates-for-2021-financial-year
Add new free allowance rates for 2021 financial year
2021-03-10 14:41:58 +00:00
David McDonald
3e80ba4734 Fix flake8 and isort errors
Note, isort now has default behaviour of searching recursively so we no
longer need the `-rc` flag
2021-03-08 18:48:56 +00:00
Chris Hill-Scott
7013eb9696 Make get_current_financial_year timezone aware
It would have given the wrong answer for the first hour of the 2021
financial year.

This was OK before, because we didn’t need this kind of precision. But
now it could mean someone signing up in the middle of the night getting
the wrong free text message allowance, so we should fix it.
2021-03-08 17:01:04 +00:00
Chris Hill-Scott
61f605ff67 Add new rates for 2021
These are the new rates from
https://docs.google.com/document/d/1aObNQNBw3ayPMl3b_Qc5kZBdaXIAMDnBGtV-xPtFBsc/edit?ts=603f68ea#

We’re changing the free allowance so we can continue to support all the
teams that use Notify. The new allowance means over 90% of teams can
still send all the text messages they need to without paying.
2021-03-08 16:59:29 +00:00
Chris Hill-Scott
9a3f2c30ef Use underscores to notate 1000s
This is easier to read than using multiplication, or nothing.
2021-03-08 16:57:57 +00:00
Chris Hill-Scott
2138ce02d9 Add NHS GP organisation type to test cases
This was missing.
2021-03-08 16:56:16 +00:00
Katie Smith
7ae4017d50 Add audit event for inviting users to a service 2021-03-08 14:34:50 +00:00
Chris Hill-Scott
bac54462db Change config structure so allowances are dated
We’re going to have different allowances next financial year. This means
that when someone adds a service, we’ll need to check which year it is,
so we can give them the right allowance.

This commit changes the config structure so that the current allowances
are explicitly assigned to the 2020/21 financial year.

It freezes the tests to the 2020/21 financial year, so they won’t start
failing automatically when next financial year comes around.
2021-03-08 14:25:26 +00:00
David McDonald
fed40326da Fix test assertion
It wasn't varying the email address seen in the header based on the two
parametrized cases. Not the end of the world, but we should make it
correct
2021-03-08 13:40:53 +00:00
Leo Hemsted
477129644d fix syntax 2021-03-05 15:05:48 +00:00
Leo Hemsted
a8c63c0483 Merge pull request #3823 from alphagov/post-to-get-user-by-email
post to get user by email
2021-03-05 14:57:12 +00:00
Leo Hemsted
4a624ace32 post to get user by email
that way we won't store any PII in logs
2021-03-05 12:43:15 +00:00
Katie Smith
0561937c13 Add an audit event when a service's broadcast permissions change
This adds an audit event to the `events` table when the broadcast
permissions for a service (the service mode, channel or provider
restriction) changes.
2021-03-04 12:09:28 +00:00
Chris Hill-Scott
a27dbd24a7 Fix the ‘revoke’ links on the API keys page
They were missing the `govuk-link--destructive` class which turns them
red, consistent with other links we use for deleting or suspending
things.
2021-03-03 15:24:38 +00:00
Chris Hill-Scott
333448cab1 Support service IDs in ‘find services by name’
Sometimes we get a service ID from a support ticket or a Slack
discussion. Rather than having to hack the URL, this PR augments the
‘Find services by name’ page to support service IDs. If a UUID is
entered, it assumes that it’s been given a service ID, and redirects
straight to the dashboard for that service, without showing any search
results (a complete UUID would never match multiple services). If the
UUID is not a service ID, the user will get a 404.
2021-03-02 10:00:51 +00:00
Tom Byers
7b67fc5f32 Fix aria on collapsed checkboxes fieldset
The fieldset that wraps the collapsible checkboxes
has an aria-describedby to make the summary its
accessible description.

This needs to point to the id of the summary but
the summary didn't have one.

These changes add the id and fix a fixture in the
tests for this module.
2021-02-25 14:00:16 +00:00