Commit Graph

12569 Commits

Author SHA1 Message Date
Chris Hill-Scott
4ce1bf436d Merge pull request #4236 from alphagov/fix-whitespace-copy
Remove whitespace from copy to clipboard component
2022-05-09 12:01:43 +01:00
Ben Thorner
efb45c0baa Merge pull request #4235 from alphagov/regroup-npm-packages-181889734
Fix incorrect group for NPM dependencies
2022-05-06 15:42:00 +01:00
Ben Thorner
d97ed69f0b Turn off NPM auditing on installation
This isn't useful as it mostly pertains to dev dependencies, where
we're not concerned about vulnerabilities as they run in isolation.
2022-05-06 12:31:52 +01:00
Ben Thorner
da7dd3a852 Fix incorrect group for NPM dependencies
This means we can use tools like "npm audit" to look for security
vulnerabilities we definitely need to fix as they could pose a
direct risk to users. I've checked each of them with @tombye and
also against an external set of principles [^1].

Note: I've skimmed through the package-lock.json to check the only
changes are to add "dev: true", as well as a few integrity hashes.

[^1]: https://betterprogramming.pub/is-this-a-dependency-or-a-devdependency-678e04a55a5c
2022-05-06 12:31:10 +01:00
Chris Hill-Scott
4d825ece9f Merge pull request #4231 from alphagov/allow-editing-pending-users
Allow editing of pending users
2022-05-06 12:29:13 +01:00
Chris Hill-Scott
f2bcc79dbd Merge pull request #4233 from alphagov/update-some-core-dependencies
Update minor and patch versions of some core dependencies
2022-05-06 11:36:58 +01:00
Chris Hill-Scott
1dd8b2513d Merge pull request #4232 from alphagov/update-test-dependencies
Update test dependencies to latest versions
2022-05-06 11:36:52 +01:00
Tom Byers
532289e677 Merge pull request #4234 from alphagov/fix-alert-area-list
Fix alignment regression error with area lists
2022-05-06 10:20:30 +01:00
Chris Hill-Scott
c6fb0e6694 Remove whitespace from copy to clipboard component
If there is whitespace in the element containing the value to be copied
then Firefox[1] includes that space in the value it puts in the clipboard.

This is obviously annoying since `foo-bar` might be a valid API key where
`foo-bar ` is not.

This commit fixes that by using the `-` in Jinja to gobble whitespace.

I also looked at doing this in the Javascript, but the browser API for
selecting some text and copying it doesn’t give an obvious place for
using `String.prototype.trim()`.

1. Tested with Firefox 100.0 on Mac OS 12.2.1
2022-05-05 15:42:05 +01:00
Ben Thorner
b6321ef4ae Remove unused "del" package
This was added in [^1] and later removed in [^2].

[^1]: e1dc6ddaef
[^2]: https://github.com/alphagov/notifications-admin/pull/3198
2022-05-05 14:51:19 +01:00
Tom Byers
65d337959d Fix alignment regression error with area lists
When we changed the layout for each alert on the
current/past/rejected alerts pages to use flexbox,
we added a fallback for older browsers that set
text-align: justify on the container:

https://github.com/alphagov/notifications-admin/pull/4171

This has led to items in the list of areas an
alert will be sent to being laid out as justified
content when they were left-aligned.

These changes set the correct alignment.
2022-05-05 14:49:52 +01:00
Chris Hill-Scott
6f95e4e0ca Pin Werkzeug to below 2.1.x
We can’t upgrade to Werkzeug 2.1.0 because the `BaseResponse` class
has been renamed. The old version of Flask we are using tries to import
`BaseResponse` causing an error.

    See https://github.com/pallets/werkzeug/issues/1963
2022-05-05 14:13:24 +01:00
Chris Hill-Scott
75a57568b6 Pin Jinja to below 3.1.x
We can’t upgrade to Jinja 3.1.0 because the `escape` module has been
moved to the `markupsafe` library. The old version of Flask we are
using tries to import `escape` from `jinja2`, causing an error.

See https://jinja.palletsprojects.com/en/3.1.x/changes/#version-3-1-0
2022-05-05 14:12:48 +01:00
Chris Hill-Scott
7a0ba988bb Update flake8 error code
flake8-print moved its namespace from `T0*` to `T2*` as a breaking
change in version 5.0.0 – see https://github.com/jbkahn/flake8-print#500---2022-04-30
2022-05-05 13:50:54 +01:00
Chris Hill-Scott
80ad40f587 Update minor and patch versions of some core dependencies 2022-05-05 13:45:42 +01:00
Chris Hill-Scott
1794344306 Update test dependencies to latest versions 2022-05-05 13:40:24 +01:00
Chris Hill-Scott
c6dc0d513e Allow editing of pending users
At the moment if a user is pending we don’t show the ‘change’ link.

This is unhelpful because:
- there’s no way to remove this user
- there’s no way to change their phone number, if the reason that
  they are still pending is because they’ve been unable to receive
  the two factor code at the number they first provided
2022-05-05 09:42:14 +01:00
Chris Hill-Scott
c5d4bfd8ef Refactor to avoid direct string comparison
Direct string comparison in multiple places is prone to typos. It
also means that a consumer of the class needs to know that whether
a user is pending or active is held in the `state` property, which
is an implementation detail.
2022-05-05 09:39:32 +01:00
Chris Hill-Scott
5ac6efc580 Refactor logic out of Jinja before making more complicated
To keep the conditionals in the Jinja template more readable, this
commit moves the logic into a method on the model, where it can
be split over multiple statements and lines.
2022-05-05 09:38:40 +01:00
Chris Hill-Scott
b4b7ecb2aa Merge pull request #4230 from alphagov/fix-broadcast-counties-page
Fix focus and spacing on counties page
2022-05-04 16:14:13 +01:00
Chris Hill-Scott
b2113fba39 Merge pull request #4228 from alphagov/remove-old-sms-price
Clean up old text message price
2022-05-04 16:01:23 +01:00
Tom Byers
77ac7b80ed Fix focus and spacing on counties page
We fixed a problem with the focus styles of list
items in this pull request:

https://github.com/alphagov/notifications-admin/pull/4141

This missed out pages for areas with counties in
them. This adds the fix to those pages.

These changes also include some extra spacing
between the end of the list and the button which
is lost by the new styles we're giving the list
items.
2022-05-04 15:06:13 +01:00
Chris Hill-Scott
a136b92078 Rename constant for clarity 2022-05-04 15:04:06 +01:00
Chris Hill-Scott
784fe24a26 Make SMS rate a constant
Now that it doesn’t depend on any logic it doesn’t need to be a
function.
2022-05-03 15:38:36 +01:00
Chris Hill-Scott
7f94232f4e Clean up old text message price
Now that the new price is in effect, we don’t need to check the date to
see which price should be displayed to the user.
2022-05-03 10:14:35 +01:00
Ben Thorner
3a1ac189ff Merge pull request #4225 from alphagov/free-allowance-api-181934027
Change annual usage to work with multiple SMS rates
2022-04-29 13:22:54 +01:00
Chris Hill-Scott
208985aa25 Merge pull request #4222 from alphagov/1-may-price-change
Update text message rate on 1 May 2022
2022-04-29 11:16:57 +01:00
Chris Hill-Scott
b142136380 Merge pull request #4224 from alphagov/bump-utils-55.1.6
Bump utils to 55.1.6
2022-04-29 11:16:50 +01:00
Chris Hill-Scott
4a0f5e8a41 Make text message price dependent on date
So we don’t have to deploy a change on a Saturday.

In the future this could pull from the rates in the database, but while
that code is shifting around I didn’t want to touoch it. We’d also have
to think about caching so as not to have a non-authenticated route
hitting the database.
2022-04-28 10:48:44 +01:00
Ben Thorner
5511f15ae8 Add missing dashboard test for zero SMS cost 2022-04-27 17:08:44 +01:00
Ben Thorner
e6c04ef556 Support variable rates for annual usage stats
Note: I've removed the pricing assertion in the "0_free_allowance"
test as it's covered elsewhere - the value of the test is really to
check that we don't show the remainder if there never was any.
2022-04-27 17:06:17 +01:00
Ben Thorner
715a3c137f Rename ambiguous "sms_chargeable" Jinja variable
Now that we have the term "charge*able*_units" we should clarify
this variable is the number we will actually charge for.
2022-04-27 17:06:16 +01:00
Ben Thorner
e0aa51c306 Use new "cost" field in usage APIs
The previous, manual calculation could be incorrect depending on
which SMS rates the free allowance was attributed to.

The new field also supersedes the old "letter_total" bolt-on so we
can get cost information consistently for both types.
2022-04-27 17:06:12 +01:00
Ben Thorner
82c3e8093d Remove redundant SMS test data for annual usage 2022-04-27 16:58:18 +01:00
Ben Thorner
4925264fb7 Remove duplicate test for usage page
This is covered by the main test for the page.
2022-04-27 16:57:11 +01:00
Ben Thorner
c6f5467009 Extend main test for service usage page
This adds missing assertions for email and SMS usage, as well as
letters with the help of some additional test data.

Previously we were only checking monthly usage (in other tests).
2022-04-27 16:57:06 +01:00
Ben Thorner
2aa3e78db2 Tidy up monthly usage test assertions
The "with_letters" was mostly a duplicate of the one before - no
change in test setup - bar the three assertions at the end.

Having the assertions in a separate test will help keep the one
above manageable as we add more assertions for the annual usage.
2022-04-27 16:37:17 +01:00
Ben Thorner
55ea5d90c7 Migrate away from ambiguous "billing_units"
This uses two new fields in the annual usage API instead of the
old one, which was actually a mix of two kinds of data [^1].

[^1]: fc378fed96
2022-04-27 16:32:52 +01:00
Ben Thorner
0648f80b9d Refactor "calculate_usage" function
This will make the following changes clearer.

In the next commits we'll go into more detail about "billing_units"
and how it differs for SMS vs. emails and letters.
2022-04-27 16:30:26 +01:00
Ben Thorner
afd3f5461a Merge pull request #4221 from alphagov/usage-tidyup
Show monthly usage rate correctly if the sms rate has changed during the financial year
2022-04-27 15:37:45 +01:00
Ben Thorner
e671df1d2c Merge pull request #4226 from alphagov/update-accessibility-statement-april-2022
Review accessibility statement
2022-04-27 15:37:39 +01:00
karlchillmaid
ef9332fce5 Update review and completion dates 2022-04-27 10:53:12 +01:00
Katie Smith
417e7370bb Merge pull request #4223 from alphagov/roadmap-april-2022
Update public roadmap, April 2022
2022-04-27 08:55:38 +01:00
karlchillmaid
fdc121d529 Bump date 2022-04-27 08:38:51 +01:00
Chris Hill-Scott
a5517f2360 Bump utils to 55.1.6
Brings in:
- [x] https://github.com/alphagov/notifications-utils/pull/966/files
2022-04-26 16:40:22 +01:00
karlchillmaid
ae2644b81c Update roadmap content 2022-04-26 16:20:29 +01:00
Ben Thorner
a02e1adbc5 Tweak usage dashboard test to cover rate changes 2022-04-26 14:02:54 +01:00
karlchillmaid
dfc37c2371 Update date 2022-04-26 12:31:19 +01:00
karlchillmaid
fa40c70267 Update dates 2022-04-26 12:21:40 +01:00
karlchillmaid
d4c19140e8 Update text message rate 2022-04-26 12:05:57 +01:00