Commit Graph

12374 Commits

Author SHA1 Message Date
Ben Thorner
fa3e6435a6 Fix small issues identified in PR review
In response to: [^1], [^2], [^3], [^4], [^5] and [^6].

[^1]: https://github.com/alphagov/notifications-admin/pull/4182#discussion_r825824485
[^2]: https://github.com/alphagov/notifications-admin/pull/4182#discussion_r825824805
[^3]: https://github.com/alphagov/notifications-admin/pull/4182#discussion_r825857745
[^4]: https://github.com/alphagov/notifications-admin/pull/4182#discussion_r825859850
[^5]: https://github.com/alphagov/notifications-admin/pull/4182#discussion_r825859982
[^6]: https://github.com/alphagov/notifications-admin/pull/4182#discussion_r826001823
2022-03-15 11:47:21 +00:00
Ben Thorner
857b8b04b0 Duplicate tests for options with branding set
This is a step towards further refactoring of the page tests, which
don't need to check in this level of detail anymore.
2022-03-15 11:47:20 +00:00
Ben Thorner
5a39e310aa Migrate two more tests to the branding utility
All of the mock / UI assertions in these tests are covered by the
tests above them - these tests were mostly targetting which options
were being shown, which we can check at a lower level.
2022-03-15 11:47:19 +00:00
Ben Thorner
1946d3c928 Migrate two branding tests to utils module
This is much simpler than trying to test the function via the page,
although there are still two scenarios to test there:

- The page with radio buttons (using NHS as an example).
- The page with a text form (using "other" as an example).

In future work we could split this test in two to make it clearer
what it's trying to test. For now, this keeps the diff simple.
2022-03-15 11:47:18 +00:00
Ben Thorner
a2d471eff4 Add missing assertion for letter button text
This is the same as the test below, which we will be removing soon.
2022-03-15 11:47:17 +00:00
Ben Thorner
2fc0a105f4 Move branding choices logic into utility module
This was a lot of code to be in a form and it's going to get even
more complicated with email branding pools. Moving it out means we
can also simplify the tests that target this code.
2022-03-15 11:47:16 +00:00
Ben Thorner
a04ed3eca5 Use separate classes for branding option forms
These are about to become a lot less similar to each other when we
add email branding pools. Note that the optional *args and *kwargs
weren't used anywhere.
2022-03-15 11:47:15 +00:00
Ben Thorner
26d1222f1c Rename branding forms to clarify who they're for
I've often struggled to find the form associated with a particular
page due to the overlapping names e.g. "SetEmailBranding" sounds
more like the radio button form a user sees than "BrandingOptions".

Almost every form in forms.py also ends with "Form", so this also
makes the branding forms consistent with that naming convention.
2022-03-15 11:47:14 +00:00
Ben Thorner
bdcdfa6d0f Standardise branding tests to start with endpoint
This makes it easier to find all the tests that are relevant and
is consistent with how we name tests elsewhere in the app.
2022-03-15 11:47:13 +00:00
Chris Hill-Scott
810bdb1290 Merge pull request #4186 from alphagov/tell-admin-app-base-url-for-registration-email
Pass admin URL to API for registration email
2022-03-07 16:09:18 +00:00
Chris Hill-Scott
50015c3125 Pass admin URL to API for registration email
This follows the pattern for invite emails where the admin app tells the
API which domain to use when generating the link.
2022-03-07 15:11:50 +00:00
Ben Thorner
39856f70d1 Merge pull request #4162 from alphagov/redis-handle-errors-180663519
Allow template changes if Redis is down
2022-03-07 14:52:05 +00:00
Ben Thorner
a5d18cf1a0 Simplify clearing the template cache
This is more consistent and more visible than a direct call to a
function. It makes use of the new decorator added in response to [^1].

[^1]: https://github.com/alphagov/notifications-admin/pull/4162#pullrequestreview-896208092
2022-03-07 14:42:55 +00:00
Ben Thorner
8aabaf1f49 Standardise when we clear template cache
This is consistent with all other methods: we clear the cache after
the actual change, not before it.

Since the new version of -utils, we're now catching redis exceptions
on delete, so this change has little effect on behaviour.
2022-03-07 13:54:01 +00:00
Ben Thorner
3f2b760efb Remove redundant deletion decorators
These are superseded by the "_delete_template_cache_for_service"
call in each of these methods.
2022-03-07 13:54:00 +00:00
Ben Thorner
81d9c73543 Bump -utils to 55.0.0
This renames "delete_cache_keys_by_pattern" to match the new method
name, which will also catch exceptions if Redis is down [1].

Note that this also includes a change to RecipientCSV [2], which has
no effect because the new default is the same as the old behaviour.

[1]: https://github.com/alphagov/notifications-utils/pull/949
[2]: https://github.com/alphagov/notifications-utils/pull/947/files#diff-a8a994bf655634f89dc7439880708b4ff0d780ac1bd8033827d8aaa2692a8e0fR373
2022-03-07 13:53:57 +00:00
Ben Thorner
f827a825a1 Merge pull request #4180 from alphagov/dedup-something-else-181415991
Link directly to email branding "something else"
2022-03-07 11:33:11 +00:00
Ben Thorner
c22d3412fa Remove redundant fixtures and test setup
In response to [^1] and [^2].

[^1]: https://github.com/alphagov/notifications-admin/pull/4180/files#r819673624
[^2]: https://github.com/alphagov/notifications-admin/pull/4180/files#r819673799
2022-03-07 10:22:52 +00:00
Leo Hemsted
a7e6d5b442 Merge pull request #4177 from alphagov/41p-on-home-page
Update price of letters on home page
2022-03-03 17:15:10 +00:00
Leo Hemsted
ceea840424 Merge pull request #4165 from alphagov/dont-require-sms-code-from-users-with-email-auth-type
Do not verify sms for pending users with email auth
2022-03-03 17:14:56 +00:00
Pea Tyczynska
ae4fc977c1 Apply suggestions from code review
Co-authored-by: Ben Thorner <benthorner@users.noreply.github.com>
2022-03-03 17:02:26 +00:00
Pea Tyczynska
8112930e24 Do not verify sms for pending users with email auth
This is to fix a bug where a user creates an account but doesn't
complete registration, then they are invited to a service that
changes their auth to email_auth, and then when they try to
complete registration they are still asked for sms code.

It should save users some pain, and reduce number of support tickets.
2022-03-03 17:02:26 +00:00
Chris Hill-Scott
fb3f79d83c Update pricing of letters on settings page
Follows https://github.com/alphagov/notifications-admin/pull/4174/files
2022-03-03 16:41:06 +00:00
Chris Hill-Scott
59681a8bf2 Update pricing of letters on features page
Follows https://github.com/alphagov/notifications-admin/pull/4174/files
2022-03-03 16:03:33 +00:00
Chris Hill-Scott
357081602c Update price of letters on home page
Follows https://github.com/alphagov/notifications-admin/pull/4174/files
2022-03-03 16:03:31 +00:00
Leo Hemsted
262e2ba6e7 Merge pull request #4167 from alphagov/change-user-auth-in-platform-admin
Allow platform admins to change user auth in the UI
2022-03-03 14:10:10 +00:00
Leo Hemsted
163ae17038 Merge pull request #4181 from alphagov/gunicorn
pin gunicorn to support newer version of eventlet
2022-03-03 14:10:03 +00:00
Pea Tyczynska
08f0393553 Allow platform admins to change user auth in the UI
So we do not have to go into the db when we need to change user
auth.

We do not allow this for users who use webauthn. We do not want to
enable security downgrade for those users.
2022-03-03 13:44:13 +00:00
Ben Thorner
8da8b167c9 Merge pull request #4169 from alphagov/downgrade-existing-letter-error
Downgrade error log for expected exception
2022-03-03 11:27:48 +00:00
Leo Hemsted
c64e19b153 pin gunicorn to support newer version of eventlet
this is consistent with notifications api
https://github.com/alphagov/notifications-api/pull/3466
2022-03-03 11:16:24 +00:00
Ben Thorner
33c6ca0989 Link directly to email branding "something else"
Previously we duplicated the "something else" email branding form
on its own page and embedded in the choices form (if it was the
only option). See [^1] for how this looks - it's inconsistent.

This DRYs-up the "something else" form by bypassing the choices
form when "something else" is the only option. I've also tweaked
the "Back" button to be consistent with this behaviour.

Making this change also simplifies the choices form, which we'll
be adding pool options to shortly. I'd like to make the letters
form consistent, but let's see how emails pan out first.

Note that the choices form will now show a single radio button if
"something else" is the only option. I think that's OK as nothing
will link to the page, and the form still works.

[^1]: https://github.com/alphagov/notifications-admin/pull/4163#issuecomment-1050088088
2022-03-03 10:18:58 +00:00
Katie Smith
47cd857388 Merge pull request #4179 from alphagov/upgrade-minor-dependencies
Upgrade minor dependencies
2022-03-02 16:05:58 +00:00
Katie Smith
ed90daa48f Update pyexcel-io from 0.6.5 to 0.6.6 2022-03-02 14:56:06 +00:00
Katie Smith
a1a377339c Update wtforms from 3.0.0 to 3.0.1 2022-03-02 14:51:37 +00:00
Katie Smith
36b4dee23e Update humanize from 3.12.0 to 4.0.0
Breaking change is due to dropping support for Python 3.6.
2022-03-02 14:45:18 +00:00
Katie Smith
4f78216411 Update govuk-bank-holidays from 0.10 to 0.11 2022-03-02 14:42:02 +00:00
Katie Smith
bc970c8d49 Bump all test dependencies 2022-03-02 14:36:27 +00:00
Leo Hemsted
cc876194d0 Merge pull request #4174 from alphagov/letter-price-increase-2022
Update letter prices
2022-03-01 13:21:05 +00:00
karlchillmaid
268feba6b5 Update ‘last updated’ information
Use same pattern as other Notify pages
2022-03-01 12:51:19 +00:00
karlchillmaid
7e98128e12 Update postage pricing table 2022-03-01 12:51:19 +00:00
Katie Smith
30cf97b6c0 Merge pull request #4168 from alphagov/free-allowance-0
Allow SMS fragment limit to be 0
2022-03-01 08:42:28 +00:00
Katie Smith
42f0d36ab8 Merge pull request #4170 from alphagov/broadcast-preview-button
Use `govukButton` to display 'Preview this alert' button
2022-02-28 14:08:04 +00:00
Katie Smith
22d25b7a1c Use govukButton to display 'Preview this alert' button
There are no changes to appearance of the 'Preview this alert' button or
what it does, but this stops a CSRF token appearing in the query
string when you click the button. We don't need a CSRF token - it's
a simple GET request which doesn't change any data. Before, we had a form
with `method="get"` but because we were using a `page_footer` a CSRF
token was being added.

We can replace both the `<form>` element and `page_footer` with a
`govukButton`. This means that we make a GET request with no CSRF token
without changing the appearance of the button.
2022-02-25 16:30:08 +00:00
Ben Thorner
35e7e5e957 Downgrade error log for expected exception
Previously we weren't sure if the cause of this exception was what
the comment below suggested [1]. I've now verified this from:

        Letter not found for service 0bd1d970-f11c-40e1-8319-4baefe6239d7 and file aa07ed06-3161-4795-93b3-b45d7c576af9

I checked that aa07ed06-3161-4795-93b3-b45d7c576af9 exists already
as a notification i.e. the comment is correct and we're not sending
users to a 404 page. It's possible there are other scenarios where
the comment is wrong, but I don't think it's worth keeping the error.

[1]: https://github.com/alphagov/notifications-admin/pull/4159
2022-02-25 14:00:02 +00:00
Katie Smith
66382c240a Delete unused config variable 2022-02-25 11:37:23 +00:00
Katie Smith
9dc3252079 Allow free allowance to be set to 0
We want to be able to set the free allowance for a service to 0, but the
form was not allowing this - it gave an error message of `Cannot be
empty`. This can be fixed by changing the WTForms validator from
`DataRequired` (which coerces 0 to falsey) to the `InputRequired`
validator.
2022-02-25 11:27:56 +00:00
Katie Smith
05b8fd7c01 Merge pull request #4163 from alphagov/branding-previews
Show a preview of GOV.UK and NHS email branding and apply straight away
2022-02-24 11:31:53 +00:00
Ben Thorner
f94c6ded5c Merge pull request #4158 from alphagov/catch-missing-recipient
Fix 500 error due to inconsistent recipient check
2022-02-24 10:17:03 +00:00
Ben Thorner
468e42a12e Merge pull request #4159 from alphagov/catch-missing-letter
Catch error if letter does not exist on send
2022-02-24 10:16:54 +00:00
Ben Thorner
3effb75045 Clarify purpose of file_id in redirects
In response to: [1].

[1]: https://github.com/alphagov/notifications-admin/pull/4159/files#r813050941
2022-02-23 17:25:35 +00:00