Commit Graph

2906 Commits

Author SHA1 Message Date
Tom Byers
b0bab205da Plug GovukRadiosField into edit sms|email pages
Proof of concept for the GovukRadiosField class.

Includes the removal of the a DataRequired
validator. This doesn't seem to be needed as the
RadioField superclass catches any submissions
without any data from field.choices in its
pre_validate method (which also outputs the
correct error message).
2020-11-12 10:13:22 +00:00
Tom Byers
dd36137e3f Add GovukRadiosField
Roughly based on GovukCheckboxesField.
2020-11-12 10:13:20 +00:00
Tom Byers
5293e3e1eb Refactor GovukCheckboxField and all variants
Aims to make the structure of their code more like
GovukTextInputField so this convention can be
extended for radios.

It does that by:
- moving the code in their widget methods out into
  the govuk_checkbox_field_widget helper function
- moving the code that wraps the checkboxes
  in HTML to make them collapsible into the helper
  function
- remove GovukCheckboxesMixin in favour of having
  the extend_params method as a stand-alone
  function*

*The code is generic enough that it can be used
with other fields that share the same type of
data.

These changes also:
- don't alter the interface of any classes
  involved
- don't break any tests
2020-11-10 22:25:40 +00:00
Tom Byers
d648af5b76 Rename govukCheckboxField and similar
Follows naming conventions for classes and matches
work done on GovukTextInputField.
2020-11-10 12:35:29 +00:00
Tom Byers
3f71138a39 Make name of govuk_field_widget more specific
There will be a variant for each type of field so
make the original specific to text input fields.
2020-11-10 12:35:29 +00:00
Katie Smith
1d1973050d Stop live services requesting to go live
Live services shouldn't be able to request to go live again. Once a
service is live we remove the option to go live from the Settings page,
but we still link to the page to request to go live from other places
e.g. the 'Get started' page. As a result, we've seen some services make
another request to go live when their service has already been live for
months - this change will stop that from happening.
2020-11-09 14:00:52 +00:00
Katie Smith
247e7c2d93 Stop checking query string for filename when sending a job
We look for `original_file_name` in the metadata now. Initially we were
still checking the query string too, but now that the change to add the
filename to the metadata has been deployed for a while there shouldn't
be any cases of the filename still being in a query string.

Since the `original_file_name` is not being added to the metadata in
`.check_messages` (it has happened earlier in the process) a few tests
are no longer needed.
2020-11-05 10:03:21 +00:00
Katie Smith
18e4e86565 Stop checking query string for filename if uploading contact list
The code was looking for `original_file_name` in the metadata for a
contact list, or the query string if it wasn't in the metadata. Now that
the change to use the metadata for the file name has been deployed for a
while e can stop looking in the query string for the
`original_file_name`.
2020-11-05 10:03:21 +00:00
Katie Smith
6940291c96 Put filename in metadata when sending via a CSV
When sending from an uploaded CSV `.send_messages` now puts the filename
in the metadata. It previously used the query string to pass the
filename to `.check_messages`, where it can be lost.
2020-10-29 13:53:50 +00:00
Katie Smith
a6c103841e Check metadata for file name when sending from contact list
The `.send_from_contact_list` function redirected to `.check_messages`
with `original_file_name` in the query string. Contact lists already
have `original_file_name` as part of their metadata, so we can stop
sending it in the query string and use the metadata instead.
2020-10-29 13:53:50 +00:00
Katie Smith
e07651ed80 Use metadata to store filename when uploading contact list
We were passing `original_file_name` from the `.upload_contact_list`
view function to the `.check_contact_list` view function as a query
param. We now store it in the metadata instead. `.check_contact_list`
still checks for `original_file_name` in the query string if it's not in
the metadata - this is necessary until the code has been deployed for a
few days and we can be sure that there are no contact lists that are
mid-way through the upload stage.
2020-10-29 13:53:50 +00:00
Chris Hill-Scott
24bafba29c Combine current and pending broadcasts
Splitting the dashboard into multiple sections was confusing, and people
sometimes mistook the headings as labels, especially when a section was
empty. It just wasn’t clear what the hierarchy of the page was.

This commit combines the current and pending broadcasts into one list
on the dashboard. Previous broadcasts have already moved to their own
page.
2020-10-27 13:12:25 +00:00
Chris Hill-Scott
f3cf080a5c Rename variable to be more precise 2020-10-26 11:09:13 +00:00
Chris Hill-Scott
eec4602efc Redirect to correct endpoint based on state
If you refresh the page on a current broadcast while someone has
cancelled it you’ll see the wrong navigation item selected. This commit
adds redirects to take you to the correct endpoint in these edge cases.
2020-10-26 10:50:09 +00:00
Chris Hill-Scott
d793d08ae7 Fix back links when viewing a broadcast
Where you go back to from a broadcast can now depend on whether it’s
a current or previous broadcast.
2020-10-26 10:50:09 +00:00
Chris Hill-Scott
b54d49196b Ensure correct selected nav item on broadcast page
Once a broadcast has been submitted for approval it either lives on the
‘Current alerts’ or ‘Previous alerts’ page, depending on where it is
in its lifecycle.

Therefore when clicking into a broadcast from one of those pages the
same navigation item should remain selected.

Because we select the navigation items based on the request endpoint,
this means we need an endpoint for each navigation page, even if the
content of the pages will be the same in both cases.

This commit adds the two new end points, removes the old, single
endpoint and updates links to point to the new endpoint.
2020-10-26 10:50:09 +00:00
Chris Hill-Scott
57fc209f44 Merge pull request #3690 from alphagov/set-message-limit
Remove the `upload_letters` permission
2020-10-23 12:27:28 +01:00
Chris Hill-Scott
43b4acf1f9 Allow platform admins to change rate limit
One less thing we have to go into the database to do, and remember to
manually clear the cache for after.
2020-10-23 12:05:45 +01:00
Chris Hill-Scott
f549168b5e Remove the upload_letters permission
Every service has it now, and we haven’t had any services ask to toggle
it off again.
2020-10-20 11:30:08 +01:00
Chris Hill-Scott
268929a093 Allow platform admins to change daily message limit
One less thing we have to go into the database to do, and remember to
manually clear the cache for after.
2020-10-19 17:44:32 +01:00
Chris Hill-Scott
43a27676cb Remove the styleguide
The idea was that this would be a place to document all the design
patterns used in Notify. However it hasn’t been kept up to date, and,
looking at the `git blame`[1] no new patterns have been added for 5
years.

I think it’s better to get rid of it than have to keep maintaining
something which is inaccurate.

1. 64aa0d359c/app/templates/views/styleguide.html
2020-10-16 10:14:23 +01:00
Chris Hill-Scott
0cd08a94ff Rename dashboard to ‘current alerts’
The dashboard for normal services is quite general, because it tells
you a bit about channels, templates and spend.

What is now the dashboard for broadcast services is much more specific,
therefore less like a dashboard. We can reflect this by giving it a more
specific name. This should reduce the amount of navigation surfing
people need to do in order to find the thing they’re looking for.
2020-10-13 14:47:27 +01:00
Chris Hill-Scott
698f98389c Remove previous broadcasts from the dashboard
Since they have their own page now they don’t need to also appear on the
dashboard.
2020-10-13 14:47:10 +01:00
Chris Hill-Scott
f0220fa9fb Make a separate page for previous alerts
Previous alerts are much less important than ones that are live or
waiting for approval.

Therefore we can make the dashboard more focused by moving previous
alerts to their own page.
2020-10-13 14:45:08 +01:00
Chris Hill-Scott
3eb97f76b8 Merge pull request #3676 from alphagov/broadcast-includes-content
Add content property to broadcast message model
2020-10-12 15:29:48 +01:00
David McDonald
895b6bcc9e Merge pull request #3674 from alphagov/remove-test-routes
Remove `test/step-` routes
2020-10-12 14:25:31 +01:00
Pea M. Tyczynska
b60d25da67 Merge pull request #3670 from alphagov/show-broadcast-tour-when-password-reset
Take user to page they are meant to visit in various sign-in flow scenarios
2020-10-12 12:27:37 +01:00
David McDonald
7d3a4e6085 Remove test/step- routes
We don't need these anymore as all users will use the `one-off/step`
routes.

This has mostly involved tidying up the tests which are still a little
disorganised and not as good as I'd like but it's a step in the right
direction.

More refactoring is still possible to the routes, it may come in a later
PR if I have time.
2020-10-09 17:36:09 +01:00
David McDonald
99880fd672 Merge pull request #3668 from alphagov/use-one-off-route
When sending to yourself use 'one-off' rather than 'test' routes
2020-10-09 16:02:01 +01:00
Chris Hill-Scott
54d4fb2a6c Allow platform admins to clear cached broadcasts
When we add a new property to the broadcast model, we need to delete any
cached broadcasts from Redis that are missing the new property. So this
adds an option to do this to the cache page in platform admin.

I’ve also tried to make it more obvious what the magic numbers in the
test fixture are doing.
2020-10-09 15:41:48 +01:00
Pea Tyczynska
2203fae195 Turn on redirects revalidate_email_sent
This is part of the work to make sure user is redirected
to the page they initially were meant to visit after
they sign in.
2020-10-09 12:39:23 +01:00
Pea Tyczynska
44ddee23ac Turn on redirects two_factor
This is part of the work to make sure user is redirected
to the page they initially were meant to visit after
they sign in.
2020-10-09 12:39:23 +01:00
Pea Tyczynska
a531c888ba Turn on redirects two_factor_email
This is part of the work to make sure user is redirected
to the page they initially were meant to visit after
they sign in.
2020-10-09 12:39:22 +01:00
Pea Tyczynska
5dd010ece8 Turn on redirects for two_factor_email_sent
This is part of the work to make sure user is redirected
to the page they initially were meant to visit after
they sign in.
2020-10-09 12:39:22 +01:00
Pea Tyczynska
a6543c6e57 Turn on redirects for sign_in
This is part of the work to make sure user is redirected
to the page they initially were meant to visit after
they sign in.
2020-10-09 12:39:22 +01:00
Pea Tyczynska
1fc2bee42d Turn on redirects for new_password
This is part of the work to make sure user is redirected
to the page they initially were meant to visit after
they sign in.
2020-10-09 12:39:21 +01:00
Pea Tyczynska
b0db60e417 Turn on redirects for email_not_received
This is part of the work to make sure user is redirected
to the page they initially were meant to visit after
they sign in.
2020-10-09 11:52:19 +01:00
Pea Tyczynska
1dd8b08042 Turn on redirects for check_and_resend_verification_code
This is part of the work to make sure user is redirected
to the page they initially were meant to visit after
they sign in.
2020-10-09 11:51:15 +01:00
Pea Tyczynska
c3b7481e11 Turn on redirects for check_and_resend_text_code
This is part of the work to make sure user is redirected
to the page they initially were meant to visit after
they sign in.
2020-10-09 11:49:48 +01:00
Chris Hill-Scott
0f5c0a251c Merge pull request #3672 from alphagov/no-personalisation-broadcast
Don’t allow or highlight personalisation in broadcast templates
2020-10-08 15:45:51 +01:00
Chris Hill-Scott
54a5306399 Merge pull request #3660 from alphagov/fix-incorrect-processing-started-time-jobs
Fix incorrect processing started time on jobs
2020-10-06 12:00:30 +01:00
Chris Hill-Scott
c8e85efd54 Don’t allow personalisation in broadcast templates
Since we don’t have a way of filling in the personalisation at the
moment we shouldn’t allow people to make templates that require it.
2020-10-05 17:17:21 +01:00
Pea Tyczynska
d089424501 Forgot password sends redirect link
with reset password email.

This is so when users reset their password they are still
redirected to pages they were meant to visit.

This change was done specifically so everyone who is meant to see
broadcast tour sees it, but it will improve lives of all users
who wanted to visit a page on Notify but then had to reset
their password in the process.
2020-10-05 16:58:43 +01:00
Leo Hemsted
6eccc66115 delete template keys properly from platform admin page 2020-10-05 16:52:48 +01:00
David McDonald
4aaf47aaa1 When sending to yourself use 'one-off' rather than 'test' routes
There is no real reason to have to support both 'one-off' steps and also
'test' steps when sending a one off notification. It's a lot of complex
code, just to now set the one of the placeholders in the session.

We make our code much simpler but no longer using the 'test' routes but
instead adding a new endpoint to set the notification recipient when
sending to yourself before continuing on with the rest of the 'one-off'
flow.

After this is deployed for a day then we can completely remove the
'test' routes and this will help remove a lot of code complexity.
2020-10-05 16:20:04 +01:00
Pea Tyczynska
ab10009e4d Redirect link included in links for password reset
on sign-in page.
2020-10-05 15:38:34 +01:00
David McDonald
389638244c Remove old tour and help arguments from sending flow
We no longer need the `start_tour` page as this has been replaced with
the new `begin_tour` page.

We also no longer need to handle the `help` argument in the
`send_test_step` or `send_one_off_step` as these no longer are
responsible for the tour and don't need to show the help text.

Worth pointing out, the new tour joins into the send one off flow. When
doing a GET `check_tour_notification`, and submitting the form shown on
this page you are POSTed to `send_notification` with `help=3`. Also for
general sending of one off notifications, the POST to
`send_notification` is done with `help=0` which is a bit of a hack to
make sure that we don't show a back link on the `view_notification` page
for when someone gets there having just sent a one off notification.
This use of `help=0` may be a candidate for a refactor in the future as
it feels like a bit of a hacky way of doing things and is therefore not
as clear to developers what is going on.

Also removes the help argument from the csv routes used here. There is
no reason that we need to ever show help for CSVs and this is leftover
code from when we used to do the tour that way.
2020-10-05 12:44:19 +01:00
David McDonald
1b310a0f8a Merge pull request #3663 from alphagov/separate-tour
Move intro to Notify tour into separate views to reduce code complexity
2020-10-05 09:53:33 +01:00
David McDonald
c1f67514a2 404 for step-0 2020-10-02 14:44:17 +01:00
David McDonald
1f900e74a9 Fix error case where the tour start page is skipped
This was causing us to key error for 'placeholders' being missing in the
session dictionary. This fixes it and sends you back to the start
2020-10-02 12:46:02 +01:00